0
$\begingroup$

Rosanswers logo

Hi,

I'd like to simulate the RTF Drone from Intel which has the R200 Camera as the main sensor. I'd like to use it for mapping simulations with GMapping. I want to build a launch file to load world, quadrotor_model, r200 camera and Gmapping in Gazebo in order to do some simulations. How can I create this costomized launch file?

I can't find a tutorial how to build customized launch files, so I'm trying some reverse engineering with the hector_quadrotor and turtlebot_gazebo packages. It's very confusing since I'm really new in ROS world.

Right now I have this:

<launch>

<!-- Start Gazebo with wg world running in (max) realtime -->

<include file="$(find hector_gazebo_worlds)/launch/willow_garage.launch"/>


<!-- Spawn simulated quadrotor uav -->

<include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch" >
<arg name="model" value="$(find hector_quadrotor_description)/urdf/quadrotor_with_kinect.xacro"/> 
</include>


</launch>

I just found a drone model using kinect but would like to use the R200 camera.

EDIT:

I am trying to add the R200 camera model to quadrotor base. My quadrotor_with_r200.urdf.xacro file looks like this:

<?xml version="1.0"?>
<robot name="quadrotor" xmlns:xacro="http://www.ros.org/wiki/xacro">

<xacro:property name="M_PI" value="3.1415926535897931" />

<!-- Included URDF Files -->
<xacro:include filename="$(find hector_quadrotor_description)/urdf/quadrotor_base.urdf.xacro" />

<!-- Instantiate quadrotor_base_macro once (has no parameters atm) -->
<xacro:quadrotor_base_macro />

<!-- Intel R200 -->
<xacro:include filename="$(find drone_application)/urdf/r200_camera.urdf.xacro" />
<xacro:r200_camera name="camera" parent="base_link">
<origin xyz="0.05 0.0 -0.1" rpy="0 0 0"/>
</xacro:r200_camera>

</robot>

Very similar to Hector quadrotor_with_kinect, but I get this erros when I try to run the launchfile:

xacro.XacroException: Invalid parameter "name" while expanding macro "xacro:r200_camera"
Invalid <param> tag: Cannot load command parameter [robot_description]: command 
[/opt/ros/indigo/share/xacro/xacro.py 
/home/andre/catkin_ws/src/drone_application/urdf/quadrotor_with_r200.urdf.xacro myvar:=true] returned with 
code [1]. 

Param xml is <param command="$(find xacro)/xacro.py $(arg model) myvar:=true" name="robot_description"/>
The traceback for the exception was written to the log file

Originally posted by Andreluizfc on ROS Answers with karma: 25 on 2017-12-30

Post score: 0


Original comments

Comment by jayess on 2017-12-30:
What's your question?

Comment by Andreluizfc on 2017-12-30:
How can I create a launch file to load in gazeebo a drone model, r200 camera and gmapping?

Comment by jayess on 2017-12-31:
This update should probably be a new question but checkout the solution to #q127541

Comment by Andreluizfc on 2018-01-02:
I could solve the problem, thanks a lot! Just removed the name="camera" in the quadrotor_with_r200.urdf.xacro.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Check out the urdf tutorials and learn how urdf and xacro files work. Then, you can use this R200 xacro file to replace the kinect in the drone you found.

You can probably do this by using the quadrotor base xacro file in the hector_quadrotor_description package and adding that R200 xacro file that I linked to.

If you call this new file quadrotor_r200.xacro then you can load this into Gazebo by using a launch file (let's call it spawn_quadrotor.launch) similar to

<launch>
  <!-- load model -->
  <param name="robot_description" command="$(find xacro)/xacro.py $(arg model) myvar:=true"/>
  <!-- Spawn a robot into Gazebo -->
  <node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-param robot_description -urdf -model quadrotor"/>
</launch>

The run this launch file as

roslaunch my_package spawn_quadrotor.launch model:=/path/to/quadrotor_r200.xacro

Originally posted by jayess with karma: 6155 on 2017-12-30

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Andreluizfc on 2017-12-30:
Thanks a lot! I was trying to figure out those urdf and xacro files. Thanks for the R200 camera model. I'll definitely study them. Cheers!

Comment by jayess on 2017-12-30:
No problem. If this solved your problem, please click the checkmark to mark the answer as correct.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.