You're reading the documentation for the non-stable development version of MoveIt 2. For the stable, released version, please have a look at Humble.
How to Teleoperate a Robotic Arm with a Gamepad
This guide will introduce you to using a gamepad to move the panda arm.
Make sure your workspace has the required packages installed and that you
have a gamepad supported by ROS2 joy. This can be tested by launching a
joy node and then running
ros2 topic echo /joy to ensure your
gamepad is detected by
Build the MoveIt2 workspace
cdto the root directory of the moveit2 workspace. (if you followed the Getting Started tutorial, this will be
Plug in your gamepad.
Source the install script and run the
source install/setup.bash, then
ros2 launch moveit_servo servo_example.launch.py
Move the arm around, using the below image as a guide.
The drawio document can be seen here.
This section explains the launch file and the node that translates gamepad inputs to motion commands.
The file that launches this example is
This launch file launches everything needed for the panda arm planning, and also launches the
joy node and the
JoyToServoPub node (which is explained below).
ComposableNode( package="moveit_servo", plugin="moveit_servo::JoyToServoPub", name="controller_to_servo_node", ), ComposableNode( package="joy", plugin="joy::Joy", name="joy_node", )
The node that translates gamepad inputs to motion commands is
This node subscribes to the joy node (which publishes messages giving the state of the gamepad). It publishes
JointJog messages, and
PlanningScene message is only published once, when the JoyToServoPub is first constructed. It simply adds some obstacles into the planning scene.
The difference between the
TwistStamped messages is
that the inverse kinematic solver moves the joints to achieve the end
effector motions defined by the
TwistStamped messages, while the
JointJog messages directly move individual joints.
joyCB function is called when a message is published to the
topic, and translates the button presses from the gamepad into commands
for the arm. If both
TwistStamped messages would be
published by the inputs, only
JointJog messages are published.