In ROS 1, we have moveit_commander, since for ROS 2 the commander is under devlopment for Python, we will be using the pymoveit package from github link (Credits: AndrejOrsula). The customised package for this task has been already added in this repository, so that you need to do much changes to start with.

However we highly encourage you to look into the pymoveit2/moveit2.py, to understand the inner working of each of the function and to alter planning parameters.

You can go through the examples inside the pymoveit2/example folder to access the same and understand how it works.


# Move to joint configuration
ros2 run pymoveit2 ex_joint_goal.py --ros-args -p joint_positions:="[1.57, -1.57, 0.0, -1.57, 0.0, 1.57]"
# Move to Cartesian pose (motion in either joint or Cartesian space)
ros2 run pymoveit2 ex_pose_goal.py --ros-args -p position:="[0.25, 0.0, 1.0]" -p quat_xyzw:="[0.0, 0.0, 0.0, 1.0]" -p cartesian:=False
# Example of adding a collision object to the planning scene of MoveIt 2
ros2 run pymoveit2 ex_collision_object.py --ros-args -p action:="add" -p position:="[0.5, 0.0, 0.5]" -p quat_xyzw:="[0.0, 0.0, -0.707, 0.707]"


Feedback of joint_states or position


Practice Assignment

SIMPLE HINT: The linear velocity is the unit vector calculated in the direction of current pose to destination pose.