/
spawn_heron.launch
120 lines (98 loc) · 5.69 KB
/
spawn_heron.launch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?xml version="1.0"?>
<!--
Software License Agreement (BSD)
\file heron_sim.launch
\authors Guy Stoppi <gstoppi@clearpathrobotics.com>
\copyright Copyright (c) 2018, Clearpath Robotics, Inc., All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that
the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Clearpath Robotics nor the names of its contributors may be used to endorse or promote
products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WAR-
RANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, IN-
DIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<launch>
<!-- Debug flag -->
<arg name="hydro_debug" default="0"/>
<rosparam param="/use_sim_time">true</rosparam>
<!-- Vehicle's initial pose -->
<arg name="x" default="0"/>
<arg name="y" default="0"/>
<arg name="z" default="0.14"/>
<arg name="roll" value="0"/>
<arg name="pitch" value="0"/>
<arg name="yaw" default="0"/>
<arg name="namespace" default=""/>
<arg name="config" default="base" />
<group ns="/$(arg namespace)">
<!-- Translates /cmd_drive message to thrusters/*/input commands -->
<node pkg="heron_gazebo" type="cmd_drive_translate" name="cmd_drive_to_thrusters">
<param name="namespace" value="$(arg namespace)" />
</node>
<!-- Filter for Imu message -->
<node pkg="imu_filter_madgwick" type="imu_filter_node" name="imu_filter_madgwick">
<param name="~use_magnetic_field_msg" value="true" />
<param name="~use_mag" value="true" />
<param name="world_frame" value="enu" />
<param name="publish_debug_topics" value="true" />
<param name="~publish_tf" value="false" />
</node>
<!--
The filter needs MagneticField messages, so start a node to translate from the Vector3Stamped messages
provided by the plugin
-->
<node pkg="heron_gazebo" type="vector3_to_magnetic_field" name="mag_translation">
<remap from="mag_in" to="imu/mag_raw" />
<remap from="mag_out" to="imu/mag" />
</node>
<!-- Heron thruster controller -->
<node pkg="heron_controller" type="controller" name="controller">
<rosparam file="$(find heron_gazebo)/config/heron_controller.yaml" />
</node>
<!-- Translate Imu's quaternion to Roll/Pitch/Yaw -->
<node pkg="heron_gazebo" type="rpy_translator" name="rpy_translator" />
<group if="$(eval namespace == '')">
<!-- Run a python script to the send a service call to gazebo_ros to spawn a URDF robot -->
<node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen"
args="-urdf -x $(arg x) -y $(arg y) -z $(arg z) -R $(arg roll) -P $(arg pitch) -Y $(arg yaw) -model heron -param /robot_description"/>
</group>
<group unless="$(eval namespace == '')">
<!-- Run a python script to the send a service call to gazebo_ros to spawn a URDF robot -->
<node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen"
args="-urdf -x $(arg x) -y $(arg y) -z $(arg z) -R $(arg roll) -P $(arg pitch) -Y $(arg yaw) -model $(arg namespace) -param /$(arg namespace)/robot_description"/>
</group>
<include file="$(find heron_control)/launch/teleop.launch">
<arg name="joystick" value="true" />
<arg name="namespace" value="$(arg namespace)" />
</include>
<!-- Translate Twist message from twist_server to Wrench message -->
<node pkg="heron_gazebo" type="twist_translate" name="twist_translate">
<rosparam file="$(find heron_gazebo)/config/heron_controller.yaml" />
<param name="cov_limits/velocity" value="0.01" />
</node>
<!-- Translates navsat/velocity from Vector3Stamped to TwistStamped on navsat/vel -->
<node pkg="heron_gazebo" type="navsat_vel_translate" name="navvel_translate" />
<node pkg="heron_gazebo" type="activate_control_service" name="activate_control_service" />
</group>
<!-- Basic localization -->
<rosparam param="/$(arg namespace)/ekf_localization_node/tf_prefix" subst_value="True">$(arg namespace)</rosparam>
<rosparam param="/$(arg namespace)/navsat_transform_node/tf_prefix" subst_value="True">$(arg namespace)</rosparam>
<rosparam param="/$(arg namespace)/navsat_transform_node/use_odometry_yaw">true</rosparam>
<include file="$(find heron_control)/launch/control.launch" ns="/$(arg namespace)" />
<!-- Launches Heron's description nodes -->
<include file="$(find heron_description)/launch/description.launch">
<arg name="namespace" value="$(arg namespace)" />
<arg name="hydro_debug" value="$(arg hydro_debug)" />
<arg name="simulation" value="true" />
<arg name="config" value="$(arg config)" />
</include>
</launch>