joint_trajectory_executor

This file is ai generated. Do not edit this file directly. Instead, edit the node source code and run the generate-node-docs command to update this file.

Node Name

joint_trajectory_executor

Description

Joint trajectory executor node that executes predefined multi-step joint trajectories for OpenManipulator robots. The node creates smooth quintic polynomial trajectories between waypoints and monitors completion of each step before proceeding to the next. It supports arbitrary numbers of joints and trajectory steps configured through ROS parameters.

Subscribers

  • Topic: /joint_states (configurable via parameter)

    • Type: sensor_msgs/msg/JointState

    • Description: Subscribes to joint states to monitor current positions and velocities for trajectory execution and step completion detection.

Actions (Client)

  • Action: /arm_controller/follow_joint_trajectory (configurable via parameter)

    • Type: control_msgs/action/FollowJointTrajectory

    • Description: Sends smooth multi-point trajectories to the arm controller using quintic polynomial interpolation with 100 waypoints per step.

Parameters

  • joint_names (string_array, required)

    • Joint names for the robot arm (e.g., [‘joint1’, ‘joint2’, ‘joint3’, ‘joint4’])

    • Default: [‘’]

  • step_names (string_array, required)

    • List of parameter names for each trajectory step (e.g., [‘step1’, ‘step2’, ‘step3’])

    • Each step name must correspond to a parameter containing target joint positions

    • Default: [‘’]

  • duration (double)

    • Duration in seconds for each trajectory step

    • Default: 10.0

  • epsilon (double)

    • Position tolerance in radians for determining step completion

    • Default: 0.01

  • action_topic (string)

    • Action server topic for sending trajectory goals

    • Default: ‘/arm_controller/follow_joint_trajectory’

  • joint_states_topic (string)

    • Topic for receiving joint state feedback

    • Default: ‘/joint_states’

  • <step_name> (double_array, one per step)

    • Target joint positions for each step defined in step_names

    • Length must match the number of joints in joint_names

    • Example: step1: [0.0, 0.5, -0.5, 0.0]

Example Usage

Basic example with 4-joint arm and 3 steps

ros2 run open_manipulator_bringup joint_trajectory_executor \
  --ros-args \
  -p joint_names:="['joint1','joint2','joint3','joint4']" \
  -p step_names:="['home','raised','extended']" \
  -p home:="[0.0, 0.0, 0.0, 0.0]" \
  -p raised:="[0.0, -1.0, 0.5, 0.5]" \
  -p extended:="[1.57, -0.5, 0.0, 0.0]" \
  -p duration:=5.0 \
  -p epsilon:=0.02

Using with a parameter file

Create trajectory_params.yaml:

/**:
  ros__parameters:
    joint_names: ['joint1', 'joint2', 'joint3', 'joint4']
    step_names: ['position1', 'position2', 'position3']
    position1: [0.0, 0.0, 0.0, 0.0]
    position2: [0.785, -0.5, 0.5, 0.0]
    position3: [1.57, -1.0, 1.0, 0.5]
    duration: 8.0
    epsilon: 0.015
    action_topic: '/arm_controller/follow_joint_trajectory'
    joint_states_topic: '/joint_states'

Launch with parameter file:

ros2 run open_manipulator_bringup joint_trajectory_executor \
  --ros-args --params-file trajectory_params.yaml

Full workflow example

# Terminal 1: Start robot hardware/simulation
ros2 launch open_manipulator_bringup open_manipulator_x.launch.py

# Terminal 2: Execute predefined trajectory
ros2 run open_manipulator_bringup joint_trajectory_executor \
  --ros-args \
  -p joint_names:="['joint1','joint2','joint3','joint4']" \
  -p step_names:="['home','pick','place']" \
  -p home:="[0.0, 0.0, 0.0, 0.0]" \
  -p pick:="[0.0, -1.2, 0.8, 0.4]" \
  -p place:="[1.57, -0.8, 0.3, 0.2]"

Monitor execution

# Monitor action feedback
ros2 action send_goal /arm_controller/follow_joint_trajectory control_msgs/action/FollowJointTrajectory "{}" --feedback

# Watch joint states
ros2 topic echo /joint_states

# Check node status
ros2 node info /joint_trajectory_executor

Trajectory Generation

The node generates smooth trajectories using quintic (5th-order) polynomial interpolation:

  • 100 waypoints per step for smooth motion

  • Calculates positions, velocities, and accelerations for each waypoint

  • Ensures zero velocity and acceleration at start and end of each step

  • Provides natural, continuous motion profiles

Step Completion Logic

The node automatically advances through steps when:

  1. All joint positions are within epsilon tolerance of target positions

  2. Logs completion message: “🎯 Step X completed!”

  3. Automatically starts next trajectory step

  4. Shuts down after completing all steps