tum_simulator for multiple ardrones

asked 2019-05-21 14:54:48 -0500

Pramod gravatar image

updated 2022-03-17 06:05:00 -0500

Tom Moore gravatar image

I'm working on a project where multiple ardrones have to cover a given area. I'm able to do ekf_localisation for a drone.But while dealing with multiple ardrones, i have no idea how to publish those transforms. When i spawned three ardrones,my tf tree look like this: tf tree . My doubts are:

  1. I dont know how to create multiple base_links with different names in tum_simulator.Can we create like that?
  2. Should we have to write multiple yaml files for multiple robots or is there any way to write in a single yaml file?

My multiple ardrone launch file :

<launch>
    <!-- Include the world -->
    <include file="$(find gazebo_ros)/launch/empty_world.launch">
        <arg name="world_name" value="$(find cvg_sim_gazebo)/worlds/empty.world" />
        <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="false" />
    </include>
    <!-- send the robot XML to param server -->
    <arg name="model_urdf" value="$(find cvg_sim_gazebo)/urdf/quadrotor_sensors.urdf.xacro" />
    <!-- Spawn 1st simulated quadrotor uav -->
    <group ns="ardrone_1">
        <param name="robot_description" command="$(find xacro)/xacro.py '$(arg model_urdf)'" />
        <node name="spawn_robot_ardrone" pkg="gazebo_ros" type="spawn_model" args="-param robot_description                         -urdf                         -x 0                         -y 0                     -z 0.5                     -R 0                     -P 0                      -Y 0                     -model ardrone_1" respawn="false" output="screen" />
        <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" output="screen">
            <param name="publish_frequency" type="double" value="50.0" />
            <param name="tf_prefix" value="ardrone_1" />
        </node>
        <node name="ground_truth_to_tf" pkg="message_to_tf" type="message_to_tf" output="screen">
            <param name="odometry_topic" value="ground_truth/state" />
            <param name="frame_id" value="odom" />
            <param name="tf_prefix" value="ardrone_1" />
        </node>
    </group>
    <!-- Spawn 2nd simulated quadrotor uav -->
    <group ns="ardrone_2">
        <param name="robot_description" command="$(find xacro)/xacro.py '$(arg model_urdf)'" />
        <node name="spawn_robot_ardrone_2" pkg="gazebo_ros" type="spawn_model" args="-param robot_description                         -urdf                         -x 1.0                          -y 1.0                         -z 0.5                         -R 0                         -P 0                          -Y 0                         -model ardrone_2" respawn="false" output="screen" />
        <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher_2" output="screen">
            <param name="publish_frequency" type="double" value="50.0" />
            <param name="tf_prefix" value="ardrone_2" />
        </node>
        <node name="ground_truth_to_tf_2" pkg="message_to_tf" type="message_to_tf" output="screen">
            <param name="odometry_topic" value="ground_truth/state" />
            <param name="frame_id" value="odom" />
            <param name="tf_prefix" value="ardrone_2" />
        </node>
    </group>
    <!-- Spawn 3rd simulated quadrotor uav -->
    <group ns="ardrone_3">
        <param name="robot_description" command="$(find xacro)/xacro.py '$(arg model_urdf)'" />
        <node name="spawn_robot_ardrone_3" pkg="gazebo_ros" type="spawn_model" args="-param robot_description                         -urdf                         -x 0                          -y 1                         -z 0.5                         -R 0                         -P 0                          -Y 0                         -model ardrone_3" respawn="false" output="screen" />
        <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher_3" output="screen">
            <param name="publish_frequency" type="double" value="50.0" />
            <param name="tf_prefix" value="ardrone_3" />
        </node>
        <node name="ground_truth_to_tf_3" pkg="message_to_tf" type="message_to_tf" output="screen">
            <param name="odometry_topic" value="ground_truth ...
(more)
edit retag flag offensive close merge delete

Comments

2

You might want to re-title this question, as it isn't really about robot_localization, but rather how you can get the tum_simulator to work with multiple robots.

Obviously, no matter which way you go, if you're working with real robots, you're going to have some kind of unique information on each. One thing you can do is have a $ROBOT environment variable, which can be read in roslaunch or even in the yaml files:

http://wiki.ros.org/roslaunch/XMLhttp://wiki.ros.org/roslaunch/XML/ros...

Then you can have a single EKF launch file that does something like this:

<arg name="robot_name" value="$(optenv ROBOT_NAME no_name)"/>

...later, in EKF config...

  <param name="odom_frame" value="$(arg robot_name)/odom"/>
  <param name="base_link_frame" value="$(arg robot_name)/base_link"/>
Tom Moore gravatar image Tom Moore  ( 2019-06-06 02:14:45 -0500 )edit