0
$\begingroup$

I'm trying multi-agent simulations using ROSBOT 2.0 by husarion. I'm comfortable with single agent but when it comes to multiple agents I'm able to spawn them and control them independently but the problem comes with Rviz. I'm unable to visualize the robot in Rviz. It spwans upside down, i'm unable to see the camera feed and lidar output but the topics are present in the rostopic list.

The below is the launch file which I run.

<launch>
  <arg name="world_name" default="worlds/empty.world"/>

  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="$(arg world_name)"/> <!-- world_name is wrt GAZEBO_RESOURCE_PATH environment variable -->
    <arg name="paused" value="false"/>
    <arg name="use_sim_time" value="true"/>
    <arg name="gui" value="true"/>
    <arg name="headless" value="false"/>
    <arg name="debug" value="true"/>
    <arg name="verbose" value="true"/>
  </include>
  <include file="$(find rosbot_gazebo)/launch/multi_rosbot.launch"/>

</launch>

Below is multi_rosbot.launch file.

<launch>
  <param name="robot_description" command="$(find xacro)/xacro.py '$(find rosbot_description)/urdf/rosbot.xacro'"/>

  <!-- BEGIN ROBOT 1-->
  <group ns="rover1">
    <param name="tf_prefix" value="rover1" />
    <include file="$(find rosbot_gazebo)/launch/rosbot_empty_world.launch" >
      <arg name="init_pose" value="-x 0 -y 0 -z 0" />
      <arg name="robot_name"  value="rover1" />
    </include>
  </group>

  <!-- BEGIN ROBOT 2-->
  <group ns="rover2">
    <param name="tf_prefix" value="rover2" />
    <include file="$(find rosbot_gazebo)/launch/rosbot_empty_world.launch" >
      <arg name="init_pose" value="-x -2 -y 0 -z 0" />
      <arg name="robot_name"  value="rover2" />
    </include>
  </group>

  <!-- BEGIN ROBOT 3 -->
  <group ns="rover3">
    <param name="tf_prefix" value="rover3" />
    <include file="$(find rosbot_gazebo)/launch/rosbot_empty_world.launch" >
      <arg name="init_pose" value="-x -4 -y 0 -z 0" />
      <arg name="robot_name"  value="rover3" />
    </include>
  </group>
</launch>

Below is the rosbot_empty_world.launch

<launch>

  <arg name="init_pose"/>
  <arg name="robot_name"/>
  <param name="robot_description" command="$(find xacro)/xacro.py '$(find rosbot_description)/urdf/rosbot.xacro'"/>
  <arg name="model" default="$(find xacro)/xacro.py '$(find rosbot_description)/urdf/rosbot.xacro'"/>
  
  <node name="rosbot_spawn" pkg="gazebo_ros" type="spawn_model" ns="/$(arg robot_name)"
        args="$(arg init_pose) -unpause -urdf -model $(arg robot_name) -param /robot_description " respawn="false" output="screen"/>

  <node pkg="robot_state_publisher" type="robot_state_publisher"  name="robot_state_publisher" ns="/$(arg robot_name)" args="--namespace=/$(arg robot_name)">
    <param name="publish_frequency" type="double" value="30.0" />
    <param name="tf_prefix" value="/$(arg robot_name)" type="str"/>
  </node> 
  <rosparam command="load" file="$(find joint_state_controller)/joint_state_controller.yaml" ns="/$(arg robot_name)"/>
  
  <node name="controller_spawner_$(arg robot_name)" pkg="controller_manager" type="spawner" ns="/$(arg robot_name)" 
        respawn="false" args=" joint_state_controller --namespace=/$(arg robot_name)" output="screen"/>

</launch>

I cannot visualize anything in Rviz. Therobot spawns upside down, the camera is blank. rviz and gazebo

Here's the rostopic list output.

wally1002@wally:~$ rostopic list
    /clock
    /gazebo/link_states
    /gazebo/model_states
    /gazebo/parameter_descriptions
    /gazebo/parameter_updates
    /gazebo/set_link_state
    /gazebo/set_model_state
    /rosout
    /rosout_agg
    /rover1/camera/depth/camera_info
    /rover1/camera/depth/image_raw
    /rover1/camera/depth/points
    /rover1/camera/parameter_descriptions
    /rover1/camera/parameter_updates
    /rover1/camera/rgb/camera_info
    /rover1/camera/rgb/image_raw
    /rover1/camera/rgb/image_raw/compressed
    /rover1/camera/rgb/image_raw/compressed/parameter_descriptions
    /rover1/camera/rgb/image_raw/compressed/parameter_updates
    /rover1/camera/rgb/image_raw/compressedDepth
    /rover1/camera/rgb/image_raw/compressedDepth/parameter_descriptions
    /rover1/camera/rgb/image_raw/compressedDepth/parameter_updates
    /rover1/camera/rgb/image_raw/theora
    /rover1/camera/rgb/image_raw/theora/parameter_descriptions
    /rover1/camera/rgb/image_raw/theora/parameter_updates
    /rover1/cmd_vel
    /rover1/imu
    /rover1/joint_states
    /rover1/odom
    /rover1/range/fl
    /rover1/range/fr
    /rover1/range/rl
    /rover1/range/rr
    /rover1/scan
    /rover2/camera/depth/camera_info
    /rover2/camera/depth/image_raw
    /rover2/camera/depth/points
    /rover2/camera/parameter_descriptions
    /rover2/camera/parameter_updates
    /rover2/camera/rgb/camera_info
    /rover2/camera/rgb/image_raw
    /rover2/camera/rgb/image_raw/compressed
    /rover2/camera/rgb/image_raw/compressed/parameter_descriptions
    /rover2/camera/rgb/image_raw/compressed/parameter_updates
    /rover2/camera/rgb/image_raw/compressedDepth
    /rover2/camera/rgb/image_raw/compressedDepth/parameter_descriptions
    /rover2/camera/rgb/image_raw/compressedDepth/parameter_updates
    /rover2/camera/rgb/image_raw/theora
    /rover2/camera/rgb/image_raw/theora/parameter_descriptions
    /rover2/camera/rgb/image_raw/theora/parameter_updates
    /rover2/cmd_vel
    /rover2/imu
    /rover2/joint_states
    /rover2/odom
    /rover2/range/fl
    /rover2/range/fr
    /rover2/range/rl
    /rover2/range/rr
    /rover2/scan
    /rover3/camera/depth/camera_info
    /rover3/camera/depth/image_raw
    /rover3/camera/depth/points
    /rover3/camera/parameter_descriptions
    /rover3/camera/parameter_updates
    /rover3/camera/rgb/camera_info
    /rover3/camera/rgb/image_raw
    /rover3/camera/rgb/image_raw/compressed
    /rover3/camera/rgb/image_raw/compressed/parameter_descriptions
    /rover3/camera/rgb/image_raw/compressed/parameter_updates
    /rover3/camera/rgb/image_raw/compressedDepth
    /rover3/camera/rgb/image_raw/compressedDepth/parameter_descriptions
    /rover3/camera/rgb/image_raw/compressedDepth/parameter_updates
    /rover3/camera/rgb/image_raw/theora
    /rover3/camera/rgb/image_raw/theora/parameter_descriptions
    /rover3/camera/rgb/image_raw/theora/parameter_updates
    /rover3/cmd_vel
    /rover3/imu
    /rover3/joint_states
    /rover3/odom
    /rover3/range/fl
    /rover3/range/fr
    /rover3/range/rl
    /rover3/range/rr
    /rover3/scan
    /tf
    /tf_static

I'm unable to solve this. Any help is appreciated. Thank You.

$\endgroup$
0
$\begingroup$

I have managed to solve the problem.

  1. It was a problem of Fixed Frame used in the visualization
  2. tf_prefix was not used correctly.

You can look at this answer for more details. Thanks to anyone who tried.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.