-
Notifications
You must be signed in to change notification settings - Fork 17
Home
Welcome to the nre_simmultihusky wiki!
This is an example of simulating and controlling multiple Husky robots. It is built as an extension of the Simulating Husky tutorial on http://wiki.ros.org/Robots/Husky
The multihusky.launch file is a working example that instantiates two simulated Huskies in Gazebo. The rviz setup is capable of using the interactive_marker_server to publish velocity commands to each Husky.
You will need to install the clearpath package...
sudo apt-get install ros-indigo-husky-simulator
Then after you have this package in your workspace: git clone
, catkin_make
, source devel/setup.bash
,
roslaunch nre_simmultihusky multihusky.launch
With any luck the command above should just work. From there, to learn what it does, I'd recommend going over the multihusky.launch file in the package which will lead you to the husky.launch fi le which does the heavy lifting of setting up the each Husky. Here is a high-level outline of what the example does...
- multihusky.launch:
- Starts Gazebo (both the sim engine and the gui)
- Start some visualization and debugging tools (rviz, rqt_console, etc.)
- For each instance of of a husky, setup the namespace, define the initial pose and include husky.launch
- husky.launch:
- Accept namespace and initial pose arguments from multihusky.launch
- Set the tf_prefix based on the namespace
- Call a xacro robot_description with namespace and tf_prefix arguments
- Spawn the Husky model in Gazebo using gazebo_ros
- Start a robot_state_publiser node
- Start a control_manager spawner and spawn the husky_joint_publisher and husky_velocity_controller. Set the base_frame_id of the husky_velocity_controller to include the specific tf_prefix.
- Start a ekf_localization node including the appropriate map, odom and base frame id's
- Start a static_transform_publisher node to establish the tf transfrom from the map to the specific odom frame.
- Start a marker_server node to allow user to drive Husky from rviz
- Start a twist_mux node which allows prioritized mixing of multiple cmd_vel messages
Here are some screen captures and images to illustrate what you should see if things are working properly.
Two Huskies in Gazebo and rviz
rosgraph showing what talks to what. Note the two namespaces (h1 and h2)
View from rqt_tf_tree to try and make sense of the tf arrangement. Getting this right was 90% of the difficulty of getting this example to work.
Consider as the starting point the husky_empty_world.launch file included in the husky_gazebo package and described in the brief [Simulating Husky] (http://wiki.ros.org/husky_gazebo/Tutorials/Simulating%20Husky) tutorial.
Here is a diagram of the various files that are included in that launch file. There are a lot of levels of abstraction. The problem is that we have to make changes that need to percolate down to many of these files. Here is an abbreviated list of things that need to be done to adapt this one robot example to allow for multiple simulated robots.
- husky_empty_world.launch: To spawn multiple instances of the husky simulation, control, etc. use group tags to define a namespace for each instance. Also need a tf_prefix for each instance.
- spawn_husky.launch: Define arguments for both namespace and tf_prefix specific to each robot instance.
- control.launch: Define the base_frame_id for the husky_velocity_controller (diff_drive_controller) so that Gazebo generates the appropriate tr_prefix.
- localization.yaml: add the map_frame configuration for the map tf.
- description.gazebo.xacro: We need to explicitly pass the namespace to the gazebo_ros_control plugin
- husky.gazebo.xacro: We need to explicitly pass the namespace to the imu_controller and gps_controller plugins. We also need to include a tf prefix in the frameId parameter.
The real issue isn't that there is a lot of changes to make, but the challenge is that you need to make these changes to six different files on four different levels of abstraction.