ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Add a camera to erratic robot model

asked 2013-01-31 23:14:19 -0600

camilla gravatar image

Hi!
I'm running the demo_2dnav_slam .launch which simulates an erratic robot equipped with an hokuyo laser range finder in Gazebo.
I tried to move the robot using

rosrun erratic_teleop erratic_keyboard_teleop

and the simulation was fine.
Then I added a camera sensor to the robot model, adding this code to erratic_base.xacro

<joint name="my_camera_joint" type="fixed">

        <origin xyz="${top_size_x/2 -0.01 -0.04} 0 ${top_size_z/2 +0.025}" rpy="0 0 0" />
            <parent link="base_top_link" />
            <child link="my_camera_link" /> 

    </joint>

    <link name="my_camera_link">
            <inertial>
                <mass value="0.01"/>
                <origin xyz="0 0 0" />
                <inertia ixx="0.001" ixy="0.0" ixz="0.0"
                         iyy="0.01" iyz="0.0" izx="0.0"
                         izz="0.01" />
            </inertial>

            <visual>
               <origin xyz="0 0 0" rpy="0 0 0"/>
               <geometry>
                  <box size="0.05 0.05 0.05" />
               </geometry>
            </visual>

            <collision>
                <origin xyz="0.0 0.0 0.0" rpy="0 0 0" />
                <geometry>
                    <box size="0.001 0.001 0.001"/>
                </geometry>
            </collision>
        </link>

    <gazebo reference="my_camera_link">
     <sensor:camera name="my_camera_sensor">
     <imageFormat>R8G8B8</imageFormat>
         <hfov>90</hfov>
     <nearClip>0.01</nearClip>
     <farClip>100</farClip>
     <updateRate>20.0</updateRate>
        <controller:gazebo_ros_camera name="my_camera_controller" plugin="libgazebo_ros_camera.so">
          <alwaysOn>true</alwaysOn>
          <updateRate>20.0</updateRate>
      <imageTopicName>my_camera/image</imageTopicName>
          <frameName>my_camera_link</frameName>
          <interface:camera name="my_camera_iface" />
        </controller:gazebo_ros_camera>
      </sensor:camera>
      <turnGravityOff>true</turnGravityOff>
      <material>Erratic/White</material>
    </gazebo>

<joint name="my_camera_optical_joint" type="fixed">
      <origin xyz="0 0 0" rpy="${-M_PI/2} 0.0 ${-M_PI/2}" />
      <parent link="my_camera_link" />
      <child link="my_camera_optical_frame"/>
    </joint>
    <link name="my_camera_optical_frame">
      <inertial>
        <mass value="0.01" />
        <origin xyz="0 0 0" />
        <inertia ixx="0.001"  ixy="0.0"  ixz="0.0"
                 iyy="0.001"  iyz="0.0"
                 izz="0.001" />
      </inertial>
      <visual>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
          <box size="0.001 0.001 0.001" />
        </geometry>
      </visual>
      <collision>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
          <box size="0.001 0.001 0.001" />
        </geometry>
      </collision>
    </link>

To do this I followed the tutorial: link

Then I tried to see if the camera was working, with:

rosrun image_view image_view image:=/my_camera/image

And it worked.
The problem is that the new model of the erratic robot lost stability and when i tried to teleoperate the new model it rears up.
Do you know how to fix this problem?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2013-02-01 02:02:48 -0600

camilla gravatar image

I solved the problem removing the line:

<turnGravityOff>true</turnGravityOff>
edit flag offensive delete link more
0

answered 2013-01-31 23:35:03 -0600

davinci gravatar image

Does it help if you set all the masses and inertia's to zero?

edit flag offensive delete link more

Comments

If I do that the model shakes and if I try to teleoperate it, it doesn't do anything.

camilla gravatar image camilla  ( 2013-01-31 23:40:53 -0600 )edit

Question Tools

Stats

Asked: 2013-01-31 23:14:19 -0600

Seen: 368 times

Last updated: Feb 01 '13