Joint Trajectory Handler¶
The joint trajectory interface, allowing you to easily send joint trajectories (handles all the extra metadata for you).
-
class
joint_trajectory_handler.
JointTrajectoryHandler
(name, controller=None, debug=False)¶ The joint trajectory interface
- Parameters
name (str) – Name of the Action Server
controller (str) – The joint controller to use. Options are:
scaled_pos_joint_traj_controller
,scaled_vel_joint_traj_controller
,pos_joint_traj_controller
,vel_joint_traj_controller
, andforward_joint_traj_controller
.debug (bool) – Turn on debug print statements
-
build_goal
(trajectory)¶ Build the trajectory goal
- Parameters
trajectory (dict or trajectory_msgs/JointTrajectory) – Trajectory to parse
- Returns
goal – The goal built from the trajectory
- Return type
trajectory_msgs/FollowJointTrajectoryGoal
-
convert_units
(trajectory, direction='to_ros')¶ Convert units from the units defined in the trajectory config to ROS default units (or vice versa).
- Parameters
trajectory (list) – Trajectory to parse
direction (str) – Which direction to convert. Options are
to_ros
orfrom_ros
.
- Returns
trajectory – Converted trajectory
- Return type
list
-
go_to_point
(point)¶ Move the arm from its current pose to a new pose.
- Parameters
point (dict or trajectory_msgs/JointTrajectoryPoint) – Trajectory point to go to
-
load_config
(filename, directory=None)¶ Load a trajectory configuration from a file
- Parameters
filename (str) – Filename of configuration to load
directory (str) – Directory where config files should be loaded from. Default is the config folder of this package
-
pack_trajectory
(trajectory)¶ Pack a trajectory into a ROS
JointTrajectory
- Parameters
trajectory (list) – Trajectory to parse
- Returns
ros_traj – A ROS trajectory
- Return type
trajectory_msgs/JointTrajectory
-
run_trajectory
(trajectory=None, blocking=True, perform_init=True)¶ Run a trajectory.
- Parameters
trajectory (dict, JointTrajectory, FollowJointTrajectoryGoal) – Trajectory to run. If excluded, the currently loaded trajectory is run
blocking (bool) – Whether to wait for the trajectory to finish.
perform_init (bool) – Whether to move to the initial point (using
initialize_time
) or skip it.
-
set_config
(config)¶ Set the trajectory configuration
- Parameters
config (dict) – Configuration to set
-
set_initialize_time
(time)¶ Set the time the robot takes to get to its initial poisiton
- Parameters
time (float) – Initialization time in seconds. Must be greater than or equal to 0
-
set_speed_factor
(speed_factor)¶ Set the speed multiplier
- Parameters
speed_factor (float) – Speed multiplier to use
-
set_trajectory
(trajectory)¶ Set the current trajectory
- Parameters
trajectory (list or trajectory_msgs/JointTrajectory) – Trajectory to parse
- Raises
ValueError – If a trajectory of incorrect type is passed
-
shutdown
()¶ Shut down gracefully