Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gazebo_ros_multicamera plugin: left camera has wrong namespace #161

Closed
jordi-pages opened this issue Jan 27, 2014 · 6 comments
Closed

gazebo_ros_multicamera plugin: left camera has wrong namespace #161

jordi-pages opened this issue Jan 27, 2014 · 6 comments

Comments

@jordi-pages
Copy link
Contributor

I am defining a stereo camera in a urdf as follows:

<gazebo reference="${name}_link">
  <sensor type="multicamera" name="gazebo_${name}_camera">
    <update_rate>25.0</update_rate>
    <camera name="left">
      <horizontal_fov>${ hfov }</horizontal_fov>
      <image>
        <width>${image_width} </width>
        <height> ${image_height}</height>
        <format>${image_format}</format>
      </image>
      <clip>
        <near>0.01</near>
        <far>100</far>
      </clip>
    </camera>
<camera name="right">
      <pose>0 -${hack_baseline} 0 0 0 0</pose>
      <horizontal_fov>${ hfov }</horizontal_fov>
      <image>
        <width>${image_width} </width>
        <height> ${image_height}</height>
        <format>${image_format}</format>
     </image>
     <clip>
       <near>0.01</near>
       <far>100</far>
     </clip>
   </camera>
   <plugin name="stereo_camera_controller" filename="libgazebo_ros_multicamera.so">
     <alwaysOn>true</alwaysOn>
     <updateRate>25.0</updateRate>
     <cameraName>${name}</cameraName>
     <imageTopicName>image</imageTopicName>
     <cameraInfoTopicName>camera_info</cameraInfoTopicName>
     <frameName>${frame_id}</frameName>
     <hackBaseline>${hack_baseline}</hackBaseline>
     <CxPrime>${(image_width+1)/2}</CxPrime>
     <Cx>${(image_width+1)/2}</Cx>
     <Cy>${(image_height+1)/2}</Cy>
     <focalLength>${focal_length}</focalLength> <!-- image_width / (2*tan(hfov_radian /2)) -->
     <distortionK1>0.0</distortionK1>
     <distortionK2>0.0</distortionK2>
     <distortionK3>0.0</distortionK3>
     <distortionT1>0.0</distortionT1>
     <distortionT2>0.0</distortionT2>
  </plugin>
</sensor>

the expected ROS topic for the camera are:

/stereo/left/camera_info
/stereo/left/image
/stereo/right/camera_info
/stereo/right/image

Unfortunately, most of the times I launch gazebo the topics are:

/stereo/camera_info
/stereo/image
/stereo/right/camera_info
/stereo/right/image

where the left camera namespace does not appear correctly. The most strange thing is that from time to time gazebo launches properly and the right camera namespace appear. No error message appears during gazebo start up.

@j-rivero
Copy link
Contributor

j-rivero commented Mar 7, 2014

I believe that we have been using the multicamera plugin extensively during the DRC developement and I've never found this problem before, so probably we have a workaround in place, a different approach or I'm plain wrong.

@hsu what could be the case?

@hsu
Copy link
Collaborator

hsu commented Mar 8, 2014

I have not seen it either, for reference, a multicamera example is found here, and here's the corresponding stereo_image_proc.

Which version/flavor of gazebo_ros_pkgs are you using?

jordi-pages added a commit to jordi-pages/gazebo_ros_pkgs that referenced this issue Mar 17, 2014
@jordi-pages
Copy link
Contributor Author

Sorry for the delay. I am working with the hydro-devel branch of gazebo_ros_pkgs. By adding a simple sleep in the appropriate place you should be able to reproduce the problem, see jordi-pages@fb0250c

with such sleep I get both cameras publishing in /stereo/image. The cause is that GazeboRosCameraUtils::LoadThread() is run before the last instruction in GazeboRosCameraUtils::Load() which appends the camera name suffix.

@j-rivero
Copy link
Contributor

Using our drcsim atlas simulation and your sleep trick I was not able to reproduce the bug, the topic namespaces are correct.

Jordi, could you quickly provide a repository with a URDF and a ROS launch that we can use to reproduce the issue? thanks.

@hsu hsu closed this as completed in 9e7ba69 Mar 27, 2014
hsu added a commit that referenced this issue Mar 27, 2014
@j-rivero
Copy link
Contributor

I spoke with John yesterday, he was able to reproduce the fail after several tries. I'm fine with the merge and the release. Thanks Jordi.

@jordi-pages
Copy link
Contributor Author

Ok, thanks a lot to both you

cohen39 pushed a commit to cohen39/gazebo_ros_pkgs that referenced this issue Nov 15, 2021
There was a race condition between GazeboRosCameraUtils::LoadThread
creating the ros::NodeHandle and GazeboRosCameraUtils::Load
suffixing the camera name in the namespace
cohen39 pushed a commit to cohen39/gazebo_ros_pkgs that referenced this issue Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants