Skip to content

Commit b977311

Browse files
author
star
committed
add gps sensor, gps navsat plugin , bridge topic for sam_bot custom robot
1 parent 2f85251 commit b977311

File tree

3 files changed

+70
-10
lines changed

3 files changed

+70
-10
lines changed

sam_bot_description/config/bridge_config.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
direction: GZ_TO_ROS
2727

2828
# Topic subscribed to by DiffDrive plugin
29-
- ros_topic_name: "/demo/cmd_vel"
29+
- ros_topic_name: "/cmd_vel"
3030
gz_topic_name: "/demo/cmd_vel"
31-
ros_type_name: "geometry_msgs/msg/TwistStamped"
31+
ros_type_name: "geometry_msgs/msg/Twist"
3232
gz_type_name: "gz.msgs.Twist"
3333
direction: ROS_TO_GZ
3434

@@ -55,3 +55,13 @@
5555
ros_type_name: "sensor_msgs/msg/PointCloud2"
5656
gz_type_name: "gz.msgs.PointCloudPacked"
5757
direction: GZ_TO_ROS
58+
59+
- topic_name: "gps/fix"
60+
ros_type_name: "sensor_msgs/msg/NavSatFix"
61+
gz_type_name: "gz.msgs.NavSat"
62+
direction: GZ_TO_ROS
63+
64+
# - topic_name: "tf"
65+
# ros_type_name: "tf2_msgs/msg/TFMessage"
66+
# gz_type_name: "gz.msgs.Pose_V"
67+
# direction: GZ_TO_ROS

sam_bot_description/src/description/sam_bot_description.sdf

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@
188188
<child>imu_link</child>
189189
<pose relative_to="base_link">0.0 0.0 0.01 0 0 0</pose>
190190
</joint>
191-
192191
<link name='imu_link'>
193192
<pose relative_to="imu_joint"/>
194193
<visual name="imu_link_visual">
@@ -271,7 +270,50 @@
271270
</imu>
272271
</sensor>
273272
</link>
274-
273+
<joint name='gps_joint' type='fixed'>
274+
<parent>base_link</parent>
275+
<child>gps_link</child>
276+
<pose relative_to="base_link">0.0 0.0 0.3 0 0 0</pose>
277+
</joint>
278+
<link name="gps_link">
279+
<!-- Some weird bug occurs if this joint gets the default inertia -->
280+
<inertial>
281+
<pose>-0.052 0 0.111 0 0 0</pose>
282+
<inertia>
283+
<ixx>0.001</ixx>
284+
<ixy>0.000</ixy>
285+
<ixz>0.000</ixz>
286+
<iyy>0.001</iyy>
287+
<iyz>0.000</iyz>
288+
<izz>0.001</izz>
289+
</inertia>
290+
<mass>0.125</mass>
291+
</inertial>
292+
<sensor name="tb3_gps" type="gps">
293+
<always_on>true</always_on>
294+
<update_rate>1</update_rate>
295+
<pose>0 0 0 0 0 0</pose>
296+
<topic>gps/fix</topic>
297+
<gz_frame_id>gps_link</gz_frame_id>
298+
<gps>
299+
<position_sensing>
300+
<horizontal>
301+
<noise type="gaussian">
302+
<mean>0.0</mean>
303+
<stddev>0.01</stddev>
304+
</noise>
305+
</horizontal>
306+
<vertical>
307+
<noise type="gaussian">
308+
<mean>0.0</mean>
309+
<stddev>0.01</stddev>
310+
</noise>
311+
</vertical>
312+
</position_sensing>
313+
</gps>
314+
</sensor>
315+
</link>
316+
275317
<plugin filename="gz-sim-diff-drive-system" name="gz::sim::systems::DiffDrive">
276318
<!-- wheels -->
277319
<left_joint>drivewhl_l_joint</left_joint>
@@ -349,11 +391,11 @@
349391
<max>3.5</max>
350392
<resolution>0.015000</resolution>
351393
</range>
352-
<noise>
394+
<!-- <noise>
353395
<type>gaussian</type>
354396
<mean>0.0</mean>
355397
<stddev>0.01</stddev>
356-
</noise>
398+
</noise> -->
357399
</ray>
358400
</sensor>
359401
</link>

sam_bot_description/world/my_world.sdf

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
name="gz::sim::systems::Sensors">
2525
<render_engine>ogre2</render_engine>
2626
</plugin>
27+
<plugin
28+
filename="gz-sim-navsat-system"
29+
name="gz::sim::systems::NavSat">
30+
</plugin>
2731
<light name='sun' type='directional'>
2832
<cast_shadows>1</cast_shadows>
2933
<pose>0 0 10 0 -0 0</pose>
@@ -104,11 +108,15 @@
104108
</scene>
105109
<wind/>
106110
<spherical_coordinates>
111+
<!-- currently gazebo has a bug: instead of outputing lat, long, altitude in ENU
112+
(x = East, y = North and z = Up) as the default configurations, it's outputting (-E)(-N)U,
113+
therefore we rotate the default frame 180 so that it would go back to ENU
114+
see: https://github.com/osrf/gazebo/issues/2022 -->
107115
<surface_model>EARTH_WGS84</surface_model>
108-
<latitude_deg>0</latitude_deg>
109-
<longitude_deg>0</longitude_deg>
110-
<elevation>0</elevation>
111-
<heading_deg>0</heading_deg>
116+
<latitude_deg>38.161479</latitude_deg>
117+
<longitude_deg>-122.454630</longitude_deg>
118+
<elevation>488.0</elevation>
119+
<heading_deg>180</heading_deg>
112120
</spherical_coordinates>
113121
<model name='unit_box'>
114122
<pose>1.51271 -0.181418 0.5 0 -0 0</pose>

0 commit comments

Comments
 (0)