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

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 Jun 21, 2019

@chapulina chapulina added the ros2 label Jun 21, 2019

@chapulina

This comment has been minimized.

Copy link
Contributor

commented Jul 15, 2019

Now that #932 has been merged, this needs rebasing

@shiveshkhaitan shiveshkhaitan force-pushed the shiveshkhaitan:multicamera branch from 768a760 to c377a96 Jul 16, 2019

@chapulina
Copy link
Contributor

left a comment

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

This comment has been minimized.

Copy link
@chapulina

chapulina Jul 27, 2019

Contributor

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 😕

This comment has been minimized.

Copy link
@shiveshkhaitan

shiveshkhaitan Aug 3, 2019

Author

I will be making the PR soon

gazebo_plugins/src/gazebo_ros_camera.cpp Show resolved Hide resolved
shiveshkhaitan and others added 2 commits Aug 3, 2019
frameName -> frame_name
Signed-off-by: Louise Poubel <louise@openrobotics.org>
@chapulina

This comment has been minimized.

Copy link
Contributor

commented Aug 6, 2019

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
Projects
None yet
2 participants
You can’t perform that action at this time.