joint_trajectory_interface
ROS joint trajectory action helpers.
This module provides helpers for ROS FollowJointTrajectory action clients used by RobotBlockSet robot interfaces. It manages trajectory points, goal sending, status monitoring, and result handling for joint-space motion commands.
based on: http://sdk.rethinkrobotics.com/wiki/Simple_Joint_trajectory_example
- class robotblockset.ros.joint_trajectory_interface.JointTrajectory(controller_ns: str, do_motion_check: bool = False, motion_check_callback: Callable[[Any], bool] | None = None)[source]
Bases:
objectHelper for ROS
FollowJointTrajectoryaction clients.- Attributes:
robot (Any) – Robot object passed to the motion-check callback.
generic_state (GoalStatus) – Reusable goal-status message used for status comparisons.
state (int) – Cached action state.
READY (int) – Readiness flag indicating whether a new trajectory can be sent.
Initialize a ROS joint-trajectory action client.
- Parameters:
controller_ns (str) – Controller namespace used to resolve action and status topics.
do_motion_check (bool, optional) – If
True, use the feedback callback to monitor motion execution.motion_check_callback (callable, optional) – Callback used to decide whether motion should be interrupted.
Notes
The constructor subscribes to the controller status topic, creates the action client, queries the joint names from ROS parameters, and resets the internal goal state.
- __init__(controller_ns: str, do_motion_check: bool = False, motion_check_callback: Callable[[Any], bool] | None = None) None[source]
Initialize a ROS joint-trajectory action client.
- Parameters:
controller_ns (str) – Controller namespace used to resolve action and status topics.
do_motion_check (bool, optional) – If
True, use the feedback callback to monitor motion execution.motion_check_callback (callable, optional) – Callback used to decide whether motion should be interrupted.
Notes
The constructor subscribes to the controller status topic, creates the action client, queries the joint names from ROS parameters, and resets the internal goal state.
- handle_status_callback(data: actionlib_msgs.msg.GoalStatusArray) None[source]
Update controller readiness from the latest action-status message.
- Parameters:
data (GoalStatusArray) – Action-status message received from the controller.
Notes
The helper marks the controller as ready only when all reported goal statuses are in the
SUCCEEDEDstate.
- add_point(positions: ndarray, velocities: ndarray, accelerations: ndarray | None = None, delta_time: float = 0.01) None[source]
Append a trajectory point to the active goal.
- Parameters:
positions (JointConfigurationType) – Joint positions of the trajectory point.
velocities (JointVelocityType) – Joint velocities of the trajectory point.
accelerations (JointAccelerationType, optional) – Joint accelerations of the trajectory point.
delta_time (float, optional) – Time offset from the previous point in seconds.
- start(max_wait_until_controller_ready: float = 10) None[source]
Send the currently prepared trajectory goal.
- Parameters:
max_wait_until_controller_ready (float, optional) – Maximum time to wait for the controller to become ready before the goal is sent.
Notes
The trajectory header timestamp is forced to zero as a workaround for controllers that may drop the first points when they are stamped in the near future.
- callback_wrapper(gh: Any) None[source]
Wrap the user motion-check callback for action feedback handling.
- Parameters:
gh (Any) – Action feedback payload forwarded by the ROS action client.
Notes
The feedback object is not used directly. The wrapper forwards the stored robot instance to
_motion_check_callback.
- wait(timeout: float = 10.0) None[source]
Wait until the active trajectory goal finishes or times out.
- Parameters:
timeout (float, optional) – Maximum time to wait in seconds.
Classes
|
Helper for ROS |