You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
7.6 KiB

1 year ago
3 years ago
  1. ![](../images/banner.png)
  2. ## Overview
  3. *stretch_gazebo* is an implementation of simulating a Stretch robot with [Gazebo](http://gazebosim.org/) simulator.
  4. ## Details
  5. The *urdf directory* contains [a xacro file](http://wiki.ros.org/xacro) that extends the capabilities of the original xacro files living in *stretch_description* package to include Gazebo functionality.
  6. The *config* directory contains rviz files and [ros_control](http://wiki.ros.org/ros_control) controller configuration files for various parts of the robot including:
  7. * Base: [diff_drive_controller/DiffDriveController](http://wiki.ros.org/diff_drive_controller)
  8. * Arm: [position_controllers/JointTrajectoryController](http://wiki.ros.org/joint_trajectory_controller)
  9. * Gripper: [position_controllers/JointTrajectoryController](http://wiki.ros.org/joint_trajectory_controller)
  10. * Head: [position_controllers/JointTrajectoryController](http://wiki.ros.org/joint_trajectory_controller)
  11. * Joints: [joint_state_controller/JointStateController](http://wiki.ros.org/joint_state_controller)
  12. The *launch* directory includes two files:
  13. * gazebo.launch: Opens up an empty Gazebo world and spawns the robot loading all the controllers, including all the sensors except Cliff sensors and respeaker.
  14. * teleop_keyboard.launch: Allows keyboard teleop in the terminal and remaps *cmd_vel* topics to */stretch_diff_drive_controller/cmd_vel*, which the robot is taking velocity commands from.
  15. * teleop_joy.launch: Spawns a joy and teleop_twist_joy instance and remaps *cmd_vel* topics to */stretch_diff_drive_controller/cmd_vel*, which the robot is taking velocity commands from. Note that the *teleop_twist_joy* package has a deadman switch by default which disables the drive commands to be published unless it is being pressed. For an Logitech F310 joystick this button is A.
  16. The *script* directory contains a single python file that publishes ground truth odometry of the robot from Gazebo.
  17. ## Setup
  18. These set up instructions will not be required on newly shipped robots. Follow these instructions if *stretch_gazebo* is not present in your ROS workspace or you are simulating Stretch on external hardware. Clone stretch_ros and realsense_gazebo_plugin packages to your catkin workspace. Then install dependencies and build the packages, with the following set of commands:
  19. ```bash
  20. mkdir -p ~/catkin_ws/src
  21. cd ~/catkin_ws/src
  22. git clone https://github.com/hello-robot/stretch_ros -b dev/noetic
  23. git clone https://github.com/pal-robotics/realsense_gazebo_plugin
  24. cd ~/catkin_ws
  25. rosdep install --from-paths src --ignore-src -r -y
  26. catkin_make
  27. ```
  28. In order to use the built packages, make the packages discoverable by sourcing the ROS workspace: `source ~/catkin_ws/devel/setup.bash`. It is popular to add the sourcing command to your `~/.bashrc` file, so that the ROS packages are discoverable in every new terminal that is opened.
  29. ## Running Demo
  30. ```bash
  31. # Terminal 1:
  32. roslaunch stretch_gazebo gazebo.launch rviz:=true
  33. # Terminal 2:
  34. roslaunch stretch_core teleop_twist.launch twist_topic:=/stretch_diff_drive_controller/cmd_vel linear:=1.0 angular:=2.0 teleop_type:=keyboard # or use teleop_type:=joystick if you have a controller
  35. ```
  36. This will launch an Rviz instance that visualizes the sensors and an empty world in Gazebo with Stretch and load all the controllers. Although, the base will be able to move with the joystick commands, the joystick won't give joint commands to arm, head or gripper. To move these joints see the next section about *Running Gazebo with MoveIt! and Stretch*.
  37. ![](../images/gazebo.png)
  38. #### Running Demo with Keyboard Teleop node
  39. *keyboard_teleop_gazebo* : node that provides a keyboard interface to control the robot's joints within the gazebo simulation.
  40. ```bash
  41. # Terminal 1:
  42. roslaunch stretch_gazebo gazebo.launch rviz:=true
  43. # Terminal 2:
  44. rosrun stretch_gazebo keyboard_teleop_gazebo
  45. ```
  46. ## Running Gazebo with MoveIt! and Stretch
  47. ```bash
  48. # Terminal 1:
  49. roslaunch stretch_gazebo gazebo.launch
  50. # Terminal 2:
  51. roslaunch stretch_core teleop_twist.launch twist_topic:=/stretch_diff_drive_controller/cmd_vel linear:=1.0 angular:=2.0 teleop_type:=keyboard # or use teleop_type:=joystick if you have a controller
  52. # Terminal 3
  53. roslaunch stretch_moveit_config demo_gazebo.launch
  54. ```
  55. This will launch an Rviz instance that visualizes the joints with markers and an empty world in Gazebo with Stretch and load all the controllers. There are pre-defined positions for each joint group for demonstration purposes. There are three joint groups, namely *stretch_arm*, *stretch_gripper* and *stretch_head* that can be controlled individually via Motion Planning Rviz plugin. Start and goal positions for joints can be selected similar to [this moveit tutorial](https://ros-planning.github.io/moveit_tutorials/doc/quickstart_in_rviz/quickstart_in_rviz_tutorial.html#choosing-specific-start-goal-states). A few notes to be kept in mind:
  56. * Planning group can be changed via *Planning Group* drop down in Planning tab of Motion Planning Rviz plugin.
  57. * Pre-defined start and goal states can be specified in *Start State* and *Goal State* drop downs in Planning tab of Motion Planning Rviz plugin.
  58. * *stretch_gripper* group does not show markers, and is intended to be controlled via the joints tab that is located in the very right of Motion Planning Rviz plugin.
  59. * When planning with *stretch_head* group make sure you select *Approx IK Solutions* in Planning tab of Motion Planning Rviz plugin.
  60. ![](../images/gazebo_moveit.gif)
  61. ## Differences in Gazebo vs Stretch
  62. The simulated Stretch RE1 differs from the robot in the following ways.
  63. ### Gazebo Sensors vs Stretch Sensors
  64. | Sensor | Gazebo | Stretch | Notes |
  65. |:---------------------:|:------------------:|:------------------:|:-----------------:|
  66. | LIDAR | :heavy_check_mark: | :heavy_check_mark: | |
  67. | Base IMU | :heavy_check_mark: | :heavy_check_mark: | |
  68. | Wrist Accelerometer | :heavy_check_mark: | :heavy_check_mark: | Modeled as an IMU |
  69. | Realsense D435i | :heavy_check_mark: | :heavy_check_mark: | |
  70. | Respeaker (Mic Array) | :x: | :heavy_check_mark: | |
  71. | Cliff Sensors | :x: | :heavy_check_mark: | |
  72. *Notes:* Although there is no microphone in Gazebo, Respeaker can be represented with a ROS node that accesses compputer's microphone. Cliff sensors are not modeled but they can also be represented as 1D LIDAR sensors. See LIDAR definition in *stretch_gazebo.urdf.xacro* file.
  73. ### MoveIt Controllers vs stretch_core
  74. Actuators are defined as *ros_control* transmission objects in Gazebo using [PositionJointInterfaces](http://docs.ros.org/en/melodic/api/hardware_interface/html/c++/classhardware__interface_1_1PositionJointInterface.html). MoveIt is configured to use three different action servers to control the body parts of stretch in Gazebo through the srdf file in *stretch_moveit_config* package. See the section above about MoveIt for details. Please note that this behavior is different than *stretch_core* as it works with a single Python interface to control all the joints.
  75. ### Uncalibrated XACRO vs Calibrated URDF
  76. We provide [stretch_calibration](../stretch_calibration/README.md) to generate a calibrated URDF that is unique to each robot. The calibrated URDF is generated from the nominal description of Stretch RE1, the xacro files that live in [stretch_description](../stretch_description/README.md). The simulated Stretch RE1 is generated from the gazebo xacro description in the *urdf directory* and is not calibrated.
  77. ## License
  78. For license information, please see the LICENSE files.