Skip to content

Instantly share code, notes, and snippets.

@mathewthomas916
Created July 28, 2020 19:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mathewthomas916/b05dc0cc6518251b485b84d0e34a6063 to your computer and use it in GitHub Desktop.
Save mathewthomas916/b05dc0cc6518251b485b84d0e34a6063 to your computer and use it in GitHub Desktop.
ROS2 URDF Gazebo Sensor
<gazebo reference="gps_link">
<sensor name="gps_sensor" type="gps">
<always_on>true</always_on>
<update_rate>1.0</update_rate>
<plugin name="gps_controller" filename="libgazebo_ros_gps_sensor.so">
<ros>
<!-- <namespace>/br</namespace> -->
<remapping>gps_controller/out:=gps</remapping>
</ros>
<frame_name>gps_link</frame_name>
</plugin>
</sensor>
<material>Gazebo/Grey</material>
</gazebo>
@fayyazpocker
Copy link

How do you set reference Latitude and Longitude ?

@rugved42
Copy link

rugved42 commented Jul 8, 2021

Hey Did you figure out how to set reference Lat and Lon?

@p0wdrdotcom
Copy link

id your gazebo world sdf file

<spherical_coordinates> <surface_model>EARTH_WGS84</surface_model> <latitude_deg>-37.644121</latitude_deg> <longitude_deg>176.183812</longitude_deg> <elevation>0</elevation> <heading_deg>0</heading_deg> </spherical_coordinates>

@stevedaining
Copy link

How do you add noise to the sensor? I've tried and under sensor and plugin and nothing works.

@rpl-geoff-mciver
Copy link

I'm not sure you can for GPS.

You can however for IMU

                <xacro:macro name="noize_gaussian" params="dev b_mean b_dev">
                    <noise type="gaussian">
                        <mean>0.0</mean>
                        <stddev>${dev}</stddev>
                        <bias_mean>${b_mean}</bias_mean>
                        <bias_stddev>${b_dev}</bias_stddev>
                    </noise>
                </xacro:macro>

                <angular_velocity>
                    <x>
                        <xacro:noize_gaussian dev="2e-4" b_mean="0.0000075" b_dev="0.0000008"/>
                    </x>
                    <y>
                        <xacro:noize_gaussian dev="2e-4" b_mean="0.0000075" b_dev="0.0000008"/>
                    </y>
                    <z>
                        <xacro:noize_gaussian dev="2e-4" b_mean="0.0000075" b_dev="0.0000008"/>
                    </z>
                </angular_velocity>
                <linear_acceleration>
                    <x>
                        <xacro:noize_gaussian dev="1.7e-2" b_mean="0.1" b_dev="0.001"/>
                    </x>
                    <y>
                        <xacro:noize_gaussian dev="1.7e-2" b_mean="0.1" b_dev="0.001"/>
                    </y>
                    <z>
                        <xacro:noize_gaussian dev="1.7e-2" b_mean="0.1" b_dev="0.001"/>
                    </z>
                </linear_acceleration>
            </imu>
      

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment