Gazebo | Ignition | Community
Ask Your Question
0

Change camera orientation

asked 2016-05-06 15:48:25 -0500

Filippo Sanfilippo gravatar image

updated 2016-05-17 10:56:47 -0500

chapulina gravatar image

Referring to the attached figure, How can I change the camera orientation so that the beer can will be visible when placed to the front of the robot?

image description

I have fixed the orientation by acting on the camera_joint rpy, as shown in the following:

  <joint name="camera_joint" type="fixed">
    <origin xyz="${2*camera_link} ${height + 2*axel_offset} 0" rpy="0 0 1.57"/>
    <parent link="link4"/>
    <child link="camera_link"/>
  </joint>

  <!-- Camera -->
  <link name="camera_link">
    <collision>
      <origin xyz="0 ${camera_link + axel_offset} 0" rpy="0 0 0"/>
      <geometry>
    <box size="${camera_link} ${camera_link} ${camera_link}"/>
      </geometry>
    </collision>

    <visual>
      <origin xyz="0 ${camera_link + axel_offset} 0" rpy="0 0 0"/>
      <geometry>
    <box size="${camera_link} ${camera_link} ${camera_link}"/>
      </geometry>
      <material name="red"/>
    </visual>

    <inertial>
      <mass value="1e-5" />
      <origin xyz="0 ${camera_link + axel_offset} 0" rpy="0 0 0"/>
      <inertia ixx="1e-6" ixy="0" ixz="0" iyy="1e-6" iyz="0" izz="1e-6" />
    </inertial>
  </link>

however, now the camera view seems obstructed by an edge of the camera box. image description

edit retag flag offensive close merge delete

Comments

You can add a 1.57 rad rotation on the z axis. <pose>0 0 0 0 0 1.57</pose> in your camera link.

Brosseau.F gravatar imageBrosseau.F ( 2016-05-09 02:10:04 -0500 )edit

I have done as follows: <joint name="camera_joint" type="fixed"> <origin xyz="${2*camera_link} ${height + 2*axel_offset} 0" rpy="0 0 1.57"/> <parent link="link4"/> <child link="camera_link"/> </joint> <link name="camera_link"> <collision> <origin xyz="0 ${camera_link + axel_offset} 0" rpy="0 0 0"/> <geometry> <box size="${camera_link} ${camera_link} ${camera_link}"/> </geometry> </collision> Do you think it is correct?

Filippo Sanfilippo gravatar imageFilippo Sanfilippo ( 2016-05-09 03:26:55 -0500 )edit

It seems right. But I don't see why the rotation is not applied. Try to add the tag of my previous comment in the sensor tag. To do a fixed joint in URD, I set the type to revolute and I add the following line : <limit lower="0" upper="0" effort="10" velocity="10"/>

Brosseau.F gravatar imageBrosseau.F ( 2016-05-09 04:04:00 -0500 )edit

Thank you for your comment. I followed your suggestion. However, now the camera view seems obstructed by an edge of the camera box. Please have a look of the new figure added above to the original post. Any ideas?

Filippo Sanfilippo gravatar imageFilippo Sanfilippo ( 2016-05-16 07:05:33 -0500 )edit

I have no idea on this one, sorry.

Brosseau.F gravatar imageBrosseau.F ( 2016-05-18 02:34:03 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-10-23 14:34:24 -0500

chaolmu gravatar image

I guess you set camera_link as reference for camera plugin. The problem is that camera is attached to the origin of camera_link, which is in the body of the box. Solution A: add another joint and virtual link (without view tag) to move camera to the surface of the box. Solution B: make camera_link virtual/transparent

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-05-06 15:48:25 -0500

Seen: 4,223 times

Last updated: May 17 '16