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

Object recognition object detected but wrong position

asked 2022-02-09 08:02:25 -0500

ROS_newbie gravatar image

updated 2022-02-22 11:14:18 -0500

lucasw gravatar image

While trying to set up object recognition on a robot created in fusion 360 using the find_object_2d package, Iam able to detect my object (coke can); however, when i open rviz, the tf of the object is recognized as above the camera rather than in front of it. Below is my urdf and 3d detection launch file. URDF:

<gazebo reference="camera_1">
   <material>${body_color}</material>
   <mu1>0.2</mu1>
   <mu2>0.2</mu2>
   <selfCollide>true</selfCollide>
    </gazebo>


<gazebo reference="camera_1">
   <sensor name="camera_1" type="depth">
   <update_rate>20</update_rate>
   <camera>
   <horizontal_fov>1.047198</horizontal_fov>
   <image>
    <width>640</width>
    <height>480</height>
    <format>R8G8B8</format>
  </image>
  <clip>
    <near>0.05</near>
    <far>3</far>
  </clip>
  </camera>
  <plugin name="camera_1_controller" filename="libgazebo_ros_openni_kinect.so">
  <baseline>0.2</baseline>
  <alwaysOn>true</alwaysOn>
  <updateRate>1.0</updateRate>
  <cameraName>camera_1_ir</cameraName>
  <imageTopicName>/camera_1/color/image_raw</imageTopicName>
  <cameraInfoTopicName>/camera_1/color/camera_info</cameraInfoTopicName>
  <depthImageTopicName>/camera_1/depth/image_raw</depthImageTopicName>
  <depthImageInfoTopicName>/camera_1/depth/camera_info</depthImageInfoTopicName>
  <pointCloudTopicName>/camera_1/depth/points</pointCloudTopicName>
  <frameName>camera_1</frameName>
  <pointCloudCutoff>0.5</pointCloudCutoff>
  <pointCloudCutoffMax>3.0</pointCloudCutoffMax>
  <distortionK1>0.00000001</distortionK1>
  <distortionK2>0.00000001</distortionK2>
  <distortionK3>0.00000001</distortionK3>
  <distortionT1>0.00000001</distortionT1>
  <distortionT2>0.00000001</distortionT2>
  <CxPrime>0</CxPrime>
  <Cx>0</Cx>
  <Cy>0</Cy>
  <focalLength>0</focalLength>
  <hackBaseline>0</hackBaseline>
</plugin>

</sensor> </gazebo>

  <link name="camera_1">
     <inertial>
     <origin rpy="0 0 0" xyz="0.012500000000000011 0.0 0.0"/>
     <mass value="0.3575"/>
     <inertia ixx="0.001266" ixy="0.0" ixz="0.0" iyy="9.3e-05" iyz="0.0" izz="0.00121"/>
     </inertial>
    <visual>
    <origin rpy="0 0 0" xyz="-0.25 -0.0 -0.15"/>
    <geometry>
    <mesh filename="package://moodz_description/meshes/camera_1.stl" scale="0.001 0.001 0.001"/>
    </geometry>
    <material name="silver"/>
    </visual>
   <collision>
   <origin rpy="0 0 0" xyz="-0.25 -0.0 -0.15"/>
  <geometry>
  <mesh filename="package://moodz_description/meshes/camera_1.stl" scale="0.001 0.001 0.001"/>
  </geometry>
  </collision>
  </link>

<joint name="Rigid4" type="fixed"> <origin rpy="0 0 0" xyz="0.25 0.0 0.15"/> <parent link="base_link"/> <child link="camera_1"/> </joint> Launch Files: 3d Object_Recognition:

 <launch>
<node name="find_object_3d" pkg="find_object_2d" type="find_object_2d" output="screen">
    <param name="gui" value="true" type="bool"/>
    <param name="settings_path" value="~/.ros/find_object_2d.ini" type="str"/>
    <param name="subscribe_depth" value="true" type="bool"/>
    <param name="session_path" value="$(find obj_detection)/sessions/coke_session.bin" type="str"/>
    <param name="objects_path" value="" type="str"/>
    <param name="object_prefix" value="object" type="str"/>
    <remap from="rgb/image_rect_color" to="/camera_1/color/image_raw"/>
    <remap from="depth_registered/image_raw" to="/camera_1/depth/image_raw"/>
    <remap from="depth_registered/camera_info" to="/camera_1_ir/depth/camera_info"/>
            </node>
<!-- Example of tf synchronisation with the objectsStamped message <node name="tf_example" pkg="find_object_2d" type="tf_example" output="screen">
    <param name="map_frame_id" value="/camera_1" type="string"/>
    <param name="object_prefix" value="object" type="str"/>
</node>-->
<launch>
    <param command="$(find xacro)/xacro $(find moodz_description)/urdf/moodz.xacro" name="robot_description"/>
    <node args="-param robot_description -urdf -model moodz" name="spawn_urdf" pkg="gazebo_ros ...
(more)
edit retag flag offensive close merge delete

Comments

1

Added points. Can you pls add the image to your question. Thank you

osilva gravatar image osilva  ( 2022-02-09 08:14:24 -0500 )edit

Image can now be viewed

ROS_newbie gravatar image ROS_newbie  ( 2022-02-09 12:21:18 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-05-23 15:08:35 -0500

ROS_newbie gravatar image

updated 2022-05-24 10:48:29 -0500

This was solved by publishing a static transform between the camera and base_link according to the following command to your launch file: <node pkg="tf" type="static_transform_publisher" name="tf" args="0 0 0 -1.58 0 -1.58 base_link camera_1 100"/> This publishes a transform from your base_link to camera_link and rotates according to the above angles.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2022-02-09 08:02:25 -0500

Seen: 106 times

Last updated: May 24 '22