ros-simulation / gazebo_ros_pkgs

Wrappers, tools and additional API's for using ROS with Gazebo
http://wiki.ros.org/gazebo_ros_pkgs
772 stars 773 forks source link

Camera intrinsic parameters should be taken from plugin #872

Open christian-rauch opened 5 years ago

christian-rauch commented 5 years ago

The Gazabo camera plugin specifies the camera intrinsic parameters (center, horizontal_fov, k1, ...) for the correct projection. The ROS publisher for the camera sensor plugins (gazebo_ros_camera, gazebo_ros_depth_camera, ...) has its own set of intrinsic parameters (Cx, focalLength, distortionK1, ...) which are only used for populating and publishing the CameraInfo message. A user of these ROS plugins needs to maintain these parameters in two places for no reason.

It would be easier and less error-prone, if the ROS plugins would directly reuse the camera parameters specified in the camera plugin than to specify them again in a second place.

yamokosk commented 4 years ago

I have just realized this myself! Insanity. And then other params like cxPrime are simply unused. And don't get me started on the multicamera plugin... It seems to me that these camera plugins could use a good dose of TLC.

Only use case a colleague brought up is to model slightly incorrect camera params. But absolutely the default should be for the ros plugin to pull information from the gazebo sensor. If I get some time in the coming weekends, I'll submit a PR to address this, unless there is some non-obvious reason to keep it this way.

chapulina commented 4 years ago

I believe that's what the auto_distortion element was created for, see https://github.com/ros-simulation/gazebo_ros_pkgs/pull/761. And on ROS 2, the parameters can only be specified on the camera as described here.

yamokosk commented 4 years ago

@chapulina Where is the documentation for the ros plugin XML parameters? Other than reading the code.

No I have not seen this and it looks like it only covers distortion and not lens parameters. But again, haven't read the code to know for sure.

chapulina commented 4 years ago

Where is the documentation for the ros plugin XML parameters?

That should be documented here, but it isn't. When you go over the code, it would be great if you could update the docs (but note that the gazebo_tutorials repository is being migrated from BitBucket to GitHub and we're not taking pull requests this week).

it looks like it only covers distortion and not lens parameters

If that's the case, I think a similar approach of adding an auto_* flag could be handy here.

Also note that Gazebo itself only supports camera intrinsics since version 9.9.

yamokosk commented 4 years ago

Thanks @chapulina, but that documentation is more narrative/tutorial in form. While useful in some usecases, a complete listing of parameters would be preferred in others (e.g. http://sdformat.org/spec?ver=1.7&elem=sensor#sensor_camera). I don't have a good suggestion for how to address this at the moment, but if I come up with one, I'll post on a new issue.