Trajectory control with Gazebo - LCAS/RBT1001 GitHub Wiki

In this workshop, you will learn how to move a simulated robot by sending a timed path (i.e. a trajectory) like the ones you computed in the previous workshops.

1. Setup and Intro

  1. :arrow_forward: :mag_right: From a terminal, launch ros2 launch mecharm_moveit_config gazebo2.launch.py, then open the VNC window from your browser at http://localhost:6080. You should see a simulation of our robot sitting on a plane next to a box, a coke can and some other objects: image

  2. :arrow_forward: :mag_right: Open the file week11/simulated_trajectories.py. This script contains a code that sends trajectories to the robot for execution based on the data defined at the beginning of the script. It also integrates the code from previous weeks for trapezoidal interpolation and computing inverse kinematics for passing from cartesian trajectories to joint trajectories.

2. Key Sections to Explore

A. Waypoint Configuration

  • Cartesian Waypoints:
    Edit the CARTESIAN_WAYPOINTS list to define new end-effector positions in 3D space.

  • Joint Waypoints:
    Edit the JOINT_WAYPOINTS list to specify direct joint angles.

  • Switch Modes:
    Set USE_CARTESIAN = True to use Cartesian waypoints, or False to use joint waypoints.

    • When it is set to False, the script will send the joint trajectory as specified in the JOINT_WAYPOINTS variable.
    • When is it set to True, it will take the cartesian points in CARTESIAN_WAYPOINTS, create trapezoidal trajectories between each pair of points, compute the inverse kinematics to obtain a joint trajectory, and send the joint trajectory to the robot.

B. Trajectory Parameters

  • Adjust MAX_CARTESIAN_VELOCITY, SEGMENT_TIME, and TICKS_PER_SEGMENT to see how they affect the trajectory.
  • Observe the console output for feedback on trajectory execution.
  • Observe the function execute_joint_trajectory, particularly lines 131-136, where it fills the trajectory message with the positions, velocities and times. Note that the velocities are always set to zero in this case, which is essentially asking the controller to stop at each point.

3. Work on your final assessment

:arrow_forward: You can reuse this code as a template for the implementation in your assessment. Depending on your chosen robot the inverse kinematics will be different, and depending on the task you will need to setup the appropriate trajectory parameters and positions.

:arrow_forward: Despite the provided code always stops at any joint position in the trajectory (velocity is set to zero), for your assessment you could use the jacobian to convert cartesian velocities from the trapezoidal trajectory into joint velocities in each intermediate point.