Remote controlling ARI with ROS simulator
There are many different ways to control a robot, and the most widely used of these is remote control. In this ARI Wiki ROS tutorial blog, we will teach you how to remote control robot ARI using the Wiki ROS simulator.
In 2019, PAL Robotics introduced a new humanoid social robot – ARI. This robot combines Service Robotics and Artificial Intelligence in one single platform, which makes ARI the ideal robot to practice your ROS skills on. ARI is able to perform a wide range of multimodal expressive gestures and behaviours, and is suitable for research in Human-Robot-Interaction, perception, cognition, navigation, and localization.
In this blog and the associated links, which is part three in a series of five tutorials, you will learn how to teleoperate the ARI mobile base using the keyboard, move the base through velocity commands, use the joint trajectory controller, move individual joints, as well as use head control and play pre-defined upper body motions.
Before starting, you should have our ARI Wiki ROS tutorial installed. If you’re unsure of how to install the simulator, check out our “how to get started” guide.
Teleoperating the mobile base with the keyboard
This tutorial demonstrates how to teleoperate ARI using the keyboard. For this it is necessary to use the ROS package key_teleop which is compatible with most ROS enabled robots.
First open two consoles and source the public simulation workspace as follows:
- $ cd ~/ari_public_ws
- $ source ./devel/setup.bash
Launching the simulation
In the first console launch, for example the following simulation:
roslaunch ari_gazebo ari_gazebo.launch public_sim:=true world:=simple_office_with_people
Gazebo will show up with ARI in the following world.
In the second console run key_teleop as follows:
rosrun key_teleop key_teleop.py
which will transform the appearance of the console into this:
Now pressing the up and down arrows will make the robot go forwards and backwards respectively. The left and right arrows will cause the robot to turn in the corresponding directions:
Moving the base through velocity commands
This tutorial shows how to send velocity commands to the mobile base controller through the topic:
Moving forward and backward
In the second console run the following instruction which will publish a constant linear velocity of 0.5 m/s along the X axis, i.e. the axis of the robot pointing forward:
rostopic pub /mobile_base_controller/cmd_vel geometry_msgs/Twist "linear: x: 0.5 y: 0.0 z: 0.0
x: 0.0 y: 0.0 z: 0.0" -r 3
rostopic pub /mobile_base_controller/cmd_vel geometry_msgs/Twist -r 3 -- '[0.5,0.0,0.0]' '[0.0, 0.0, 0.0]'
Note that the argument -r 3 specifies that the message will be published 3 times per second. This is necessary to maintain a constant speed as the mobile_base_controller only applies a given velocity for less than a second for safety reasons.
In order to move backwards it is only necessary to set a negative sign on the x component of the linear velocity vector of the Twist message.
It’s also possible to make the robot turn left or right using a similar approach.
Joint Trajectory Controller
This tutorial shows how to use the joint_trajectory_controller to move ARI’s arm. The action can be used to give a trajectory to the arm expressed in several waypoints.
There are two mechanisms for sending trajectories to the controller, as written in joint_trajectory_controller. By means of the action interface or the topic interface. Both use the trajectory_msgs/JointTrajectory message to specify trajectories.
For ARI the following interfaces are available: head control, arm left control, arm right control, hand right control, hand left control. View more information on the controllers.
Launching the nodes
Now we are going to run an example with two waypoints that will bring ARI to the following joint space configurations of the right arm.
arm_1_joint: 0.65 arm_2_joint: 0.35 arm_3_joint: 0 arm_4_joint: 0
arm_1_joint: 1.13 arm_2_joint: 0.17 arm_3_joint: 0 arm_4_joint: 0
The node that will take care to execute the set of waypoints to reach such a kinematic configuration is run_traj_control included in ari_trajectory_controller package and has to be called as follows:
rosrun ari_trajectory_controller run_traj_control
Moving individual joints
This tutorial shows two different ways to move individual joints in position mode. One is from the command line and the other is through a Qt GUI.
Moving joints with the rqt GUI
In the second console run this:
rosrun rqt_joint_trajectory_controller rqt_joint_trajectory_controller
First in the dropdown list on the left we need to select controller_manager and then we will be able to select among the controllers of different groups of joints listed in the dropdown list on the right. As also listed in http://wiki.ros.org/Robots/ARI/Tutorials/trajectory_controller. For example, if we select the arm_right_controller the following sliders will appear in order to control each joint of the arm individually:
First of all the red button needs to be clicked so that it turns green. That means that the GUI is ready to send commands to the topic interface of the joint_trajectory_controller corresponding to the selected group of joints and this will help you to remote control the robot.
Moving joints from command line
The play_motion package offers a move_joint node that can be used to move individual joints from the command line and will help you to remote control robot ARI.
For example, if we want to lower ARI’s head we may run:
rosrun play_motion move_joint head_2_joint -0.6 2.0
which will print the following output and will effectively lower the robot’s head:
Moving joint head_2_joint to position -0.6 in 2.0s
The output is self-explanatory: the first argument is the name of the joint to move; the second is the target position and the third one is the time given to reach this position.
Playing pre-defined upper body motions
The purpose of this tutorial is to show how to run pre-defined upper body motions with ARI. This is relatively simple using the play_motion package, which enables executing simultaneous trajectories in multiple groups of joints.
Launching the simulation
In the first console launch for example the following simulation:
roslaunch ari_gazebo ari_gazebo.launch public_sim:=true world:=empty
Gazebo will display ARI in a virtual world.
In order to see the names of the motions defined run the following instruction in the second console:
$ rosparam list | grep "play_motion/motions" | grep "meta/name" | cut -d '/' -f 4
The following motions are available in the public simulation:
bow look_around nod shake_left shake_right show_left show_right start_ari Wave
As mentioned, the play_motion is an action server. In order to run a motion the following graphical action client can be used:
$ rosrun actionlib axclient.py /play_motion
In the GUI the name of the motion to run must be filled. The skip_planning is set by default to false, which means that the transition to the first position of the joint trajectory will use planning to prevent collisions. The remainder of the trajectory is always executed without planning as it is the responsibility of the programmer to define a safe trajectory. Set skip_planning to true only if you are sure that it is safe to reach the first positions in the trajectory from the current kinematic configuration of the robot.
By pressing the SEND GOAL button the request will be sent to /play_motion Action Server and the motion will start executing.
C++ and Python action clients
In ari_tutorials/run_motion there are play_motion action clients in C++ and Python.
The usage of the C++ action client node is as follows:
rosrun play_motion run_motion wave
Where the argument is the name of the motion. If no motion is given the list of available motions will be printed out.
The Python action client node is run as follows:
rosrun play_motion run_motion_python_node.py home
Finally, to see more details on all of the above tutorials, visit the Wiki ROS Control section
Now you are ready to control and command our social robot ARI from your own computer without needing to have the actual robot. As well as this tutorial on how to remote control robot ARI, stay tuned for further tutorial blogs! You can also find this tutorial on how to navigate with ARI using SLAM.
We would love to see you trying out our ARI simulator; let us know more about your experiences by tagging us or using the hashtag #PALRobotics on Twitter, Facebook, LinkedIn or Instagram and we will share your work.
Would you like to learn more about our social robot ARI? Make sure you visit PAL Robotics’ website and its blog on robotics and research. If you have any questions don’t hesitate to get in touch with our team to ask more about how to use ARI, and ARI’s capabilities.