Cartesian Trajectory Handler

The cartesian trajectory interface, allowing you to easily send cartesian trajectories (handles all the extra metadata for you).

class cartesian_trajectory_handler.CartesianTrajectoryHandler(name, controller=None, debug=False)

The cartesian trajectory interface

Parameters
  • name (str) – Name of the Action Server

  • controller (str) – The cartesian controller to use. Options are: forward_cartesian_traj_controller, pose_based_cartesian_traj_controller, and joint_based_cartesian_traj_controller.

  • debug (bool) – Turn on debug print statements

build_goal(trajectory)

Build the trajectory goal

Parameters

trajectory (dict or cartesian_control_msgs/CartesianTrajectory) – Trajectory to parse

Returns

goal – The goal built from the trajectory

Return type

cartesian_control_msgs/FollowCartesianTrajectoryGoal

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 or from_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 cartesian_control_msgs/CartesianTrajectoryPoint) – 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 CartesianTrajectory

Parameters

trajectory (list) – Trajectory to parse

Returns

ros_traj – A ROS trajectory

Return type

cartesian_control_msgs/CartesianTrajectory

run_trajectory(trajectory=None, blocking=True, perform_init=True)

Run a trajectory.

Parameters
  • trajectory (dict, CartesianTrajectory, FollowCartesianTrajectoryGoal) – 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 cartesian_control_msgs/CartesianTrajectory) – Trajectory to parse

Raises

ValueError – If a trajectory of incorrect type is passed

shutdown()

Shut down gracefully