-
Notifications
You must be signed in to change notification settings - Fork 7
Trajectory control with Gazebo
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.
-
▶️ 🔎 From a terminal, launchros2 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:
-
▶️ 🔎 Open the fileweek11/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.
-
Cartesian Waypoints:
Edit theCARTESIAN_WAYPOINTSlist to define new end-effector positions in 3D space. -
Joint Waypoints:
Edit theJOINT_WAYPOINTSlist to specify direct joint angles. -
Switch Modes:
SetUSE_CARTESIAN = Trueto use Cartesian waypoints, orFalseto use joint waypoints.- When it is set to
False, the script will send the joint trajectory as specified in theJOINT_WAYPOINTSvariable. - When is it set to
True, it will take the cartesian points inCARTESIAN_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.
- When it is set to
- Adjust
MAX_CARTESIAN_VELOCITY,SEGMENT_TIME, andTICKS_PER_SEGMENTto 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.
Parts for the workshops are extracted, edited from and/or inspired by the following sources.
- Official ROS humble tutorials: https://docs.ros.org/en/humble/Tutorials.html
- Elephant Robotics docs: https://docs.elephantrobotics.com/docs/gitbook-en/