How to implement synchronous simulation of robots in rviz and gazebo? [closed]

asked 2018-03-28 05:09:44 -0600

stefanvan gravatar image

updated 2018-03-28 05:21:34 -0600

Hi everyone, I'm a clumsy beginner in ros. Now I got a task of implementing synchronous simulation of my robot model both in rviz and gazebo, and I put a laser and a imu on the model previously. I want the robot to work on gazebo and the data of these two sensors can be observed in rviz intuitively. In addition, the model should move automatically in rviz according to the messages on topic /cmd_vel that users publish. How can I achieve my purpose? Here is the definition of my laser gazebo plugin and imu gazebo plugin:

  <xacro:macro name="sim_imu">
    <gazebo>
        <plugin name="imu_controller" filename="libgazebo_ros_imu.so">
            <alwaysOn>true</alwaysOn>
            <updateRate>30</updateRate>
            <bodyName>gyro_link</bodyName>
            <topicName>imu/data</topicName>
            <serviceName>imu/is_calibrated</serviceName>
            <gaussianNoise>${0.0017*0.0017}</gaussianNoise>
            <xyzOffsets>0 0 0</xyzOffsets>
            <rpyOffsets>0 0 0</rpyOffsets>
        </plugin>
    </gazebo>
</xacro:macro>

<xacro:macro name="sim_laser">
    <gazebo reference="laser_link">
        <sensor type="ray" name="laser_sensor">
            <pose>0.01 0 0.0175 0 -0 0</pose>
            <visualize>true</visualize>
            <update_rate>20</update_rate>
            <ray>
                <scan>
                    <horizontal>
                        <samples>640</samples>
                        <resolution>1</resolution>
                        <min_angle>-2.26889</min_angle>
                        <max_angle>2.268899</max_angle>
                    </horizontal>
                </scan>
                <range>
                    <min>0.08</min>
                    <max>6</max>
                    <resolution>0.01</resolution>
                </range>
                <noise>
                    <type>gaussian</type>
                    <mean>0.0</mean>
                    <stddev>0.01</stddev>
                </noise>
            </ray>
            <plugin name="gazebo_ros_laser_controller" filename="libgazebo_ros_laser.so">
                <topicName>/scan</topicName>
                <frameName>laser_link</frameName>
            </plugin>
        </sensor>
    </gazebo>
</xacro:macro>
edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by jayess
close date 2018-03-31 11:00:56.736713

Comments

Duplicate of #q287058

jayess gravatar image jayess  ( 2018-03-31 11:01:12 -0600 )edit