Running the Simulated Robot - SAR-Research-Lab/R2ED_humanoid GitHub Wiki
The humanoid can be simulated in a couple of configurations using a specific launch file. The two primary configurations are a stationary body with arms and a full mobile humanoid. Just the Ridgeback mobile platform can also be simulated. The ROS controller topics are named as fittingly as possible. After launching the simulation as shown below look over the topics: rostopic list
. The two applications used in simulating the humanoid are Gazebo and Rviz. Gazebo can construct a world for the robot to exist in and Rviz can show how the robot perceives the world through its sensors. The MoveIt! plugin for Rviz provides motion planning and collision detection.
Demo video of Humanoid simulation: Gazebo and Rviz video
Be sure you have completed the simulation installation steps
To run the simulation using MoveIt!:
$ roslaunch grasping_sim one_arm_joint_control.launch
Or to launch the full robot with MoveIt! setup for a arm:
roslaunch right_arm_full_moveit_config demo.launch rviz_tutorial:=true
To setup MoveIt! for your own specific needs you can use the Setup Assistant and follow the guide at MoveIt! Setup Assistant:
roslaunch moveit_setup_assistant setup_assistant.launch
Control the robot using MoveIt through rviz. This will generate collision-free paths for the arm from its current state to a goal state of the end effector, you will not have control over each individual joint.
There is also an example python script called moveit_test.py in simulation/grasping_sim/src that shows how moveit can be controlled programmatically.
To run the simulation WITHOUT MoveIt!:
roslaunch grasping_sim arm_control.launch
This will launch gazebo and the joint group position controller which will allow you to control the joint states individually by publishing a message to this topic: /arm/joint_group_position_controller/command
To control the left arm publish a topic to the /arm/joint_group_position_controller:
rostopic pub /arm/joint_group_position_controller/command std_msgs/Float64MultiArray '{data: [1,1,1,1,1,1]}' --once
This will set all the joints to 1 radian
To run a stationary body with two arms in Gazebo:
roslaunch grasping_sim two_arm_control.launch
And moving the left arm:
rostopic pub /arm/joint_group_position_controller/command std_msgs/Float64MultiArray '{data: [0, 1, 0.2, 0.2, -0.5, -0.5]}' --once
To run the full humanoid simulation in Gazebo:
Install the Clearpath Ridgeback ROS packages if you haven't done so yet:
sudo apt-get install ros-kinetic-ridgeback-simulator ros-kinetic-ridgeback-desktop
Or for Melodic:
sudo apt-get install ros-melodic-ridgeback-simulator ros-melodic-ridgeback-desktop
To launch the full robot in Gazebo:
roslaunch grasping_sim full_humanoid_gazebo.launch
To control the left arm:
rostopic pub /arm/joint_group_position_controller/command std_msgs/Float64MultiArray '{data: [1, 1, -1, 1, 1, 1]}' --once
To control the right arm:
rostopic pub /right_arm/joint_group_position_controller/command std_msgs/Float64MultiArray '{data: [0,-1,0.2,-0.2,0.5,0.5]}' --once
To control the left SDH:
rostopic pub /left_hand/joint_group_position_controller/command std_msgs/Float64MultiArray '{data:[0.1, -0.6, 0.2, 0.1, -0.6, 0.2, -0.6, 0.2]}' --once
To control the right SDH:
rostopic pub /right_hand/joint_group_position_controller/command std_msgs/Float64MultiArray '{data:[0.1, -0.6, 0.2, 0.1, -0.6, 0.2, -0.6, 0.2]}' --once
To control the neck:
rostopic pub /neck/joint_position_controller/command -1 std_msgs/Float64 -- '0.2'
To control the backlift:
rostopic pub /backlift/joint_position_controller/command -1 std_msgs/Float64 -- '-0.2'
To control the Ridgeback only the x velocity and the yaw are specified. For example to move forward and turn left:
rostopic pub -r 1 /cmd_vel geometry_msgs/Twist '[1, 0, 0]' '[0, 0, 1]'
The Ridgeback's laser scan data can be viwed by:
rostopic echo /front/scan
To run just the Ridgeback in Gazebo
roslaunch grasping_sim ridgeback_only.launch
Robot in Rviz
To see the humanoid in Rviz first open a new terminal window and from the project directory source the setup.bash and then run rviz:
source dev/setup.bash
rosrun rviz rviz
Once Rviz is running click on the "Add" button in the lower left of the window. A "Create Visualization" window should open. Select the "RobotModel" in the "rviz" section. Click "OK" to put the humanoid in Rviz. In the Rviz main window, change the "Fixed Frame" to "base_link" in the "Global Options" section of "Display." The robot should now be shown.