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

[ros2] Port multicamera to ros2 #939

Merged
merged 4 commits into from
Aug 6, 2019

Conversation

shiveshkhaitan
Copy link

@shiveshkhaitan shiveshkhaitan commented Jun 21, 2019

Port gazebo_ros_multicamera plugin to ROS2.

Example:

<plugin name="camera_controller" filename="libgazebo_ros_camera.so">
  <ros>
      <namespace>demo_cam</namespace>
      <!-- topics need to be prefixed with camera_name for remapping -->
      <argument>mycamera/left/image_raw:=mycamera/left/image_demo</argument>
      <argument>mycamera/right/image_raw:=mycamera/right/image_demo</argument>
       <argument>mycamera/left/camera_info:=mycamera/left/camera_info_demo</argument>
       <argument>mycamera/right/camera_info:=mycamera/right/camera_info_demo</argument>
    </ros>

  <camera_name>mycamera</camera_name>
  <sensor_type>2</sensor_type>
  <!-- frame_name>omit so it defaults to link name</frameName-->
</plugin>

Instead of a new plugin, multicamera has been integrated into gazebo_ros_camera. To use it as multicamera, <sensor_type> has to be specified as 2. It also includes gazebo_ros_triggered_multicamera

@chapulina chapulina self-requested a review June 21, 2019 19:48
@chapulina chapulina added the ros2 label Jun 21, 2019
@chapulina
Copy link
Contributor

Now that #932 has been merged, this needs rebasing

Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me! The requests for changes are minimal, the only critical one is changing the plugin namespace.

gazebo_plugins/src/MultiCameraPlugin.cpp Outdated Show resolved Hide resolved
gazebo_plugins/src/MultiCameraPlugin.cpp Outdated Show resolved Hide resolved
#include "gazebo/rendering/Camera.hh"
#include "gazebo/util/system.hh"

namespace gazebo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we put this plugin in the gazebo_plugins namespace? Just in case someone creates the same plugin for Gazebo in the future.

In fact, feel free to make a pull request adding this plugin to Gazebo 9 if you have time. It would be just a matter of copying this and the cc file over, and making a couple tweaks to follow Gazebo's style guide (which is different from ROS 2).

I can help you out with style changes for you since I'm used to it. Some things I can already see:

  • rename .hpp to .hh and .cpp to .cc
  • Use camelCase (i.e. cameraNum)
  • Prefix all arguments with _ (i.e. _cameraNum)
  • There should be one public / protected / private per member
  • { in a new line

The only problem is that even if we release this plugin for Gazebo 9.X, it won't be available to most ROS users, which use Gazebo 9.0.0 from Ubuntu. So we woudn't be able to use it in gazebo_ros_pkgs's debian packages 😕

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will be making the PR soon

gazebo_plugins/src/gazebo_ros_camera.cpp Show resolved Hide resolved
@chapulina
Copy link
Contributor

LGTM. We could backport this to dashing.

@chapulina chapulina merged commit e29cb14 into ros-simulation:ros2 Aug 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants