Info of the virtual camera


#1

Hello,

I have a virtual camera placed somewhere in the world and I would like to now its parameters. Usually, ROS-topic /camera_info contains information about the camera, like camera matrix, for example. Is there any possibility to get this information from Sphinx without using ROS-plugins?

Thank you.


#2

You can retrieve sensors info published on the ~/sensor topic in a plugin:

///////////////////////////////////////////////
ExamplePlugin::ExamplePlugin() : WorldPlugin()
{
  this->node = transport::NodePtr(new transport::Node());
  this->node->Init();
  this->sensorSub = this->node->Subscribe("~/sensor",
      &ExamplePlugin::OnSensorMsg, this, true);
}

//////////////////////////////////////////////////
void ExamplePlugin::OnSensorMsg(ConstSensorPtr &_msg)
{
  if (_msg->type() == "camera" || _msg->type() == "wideanglecamera")
  {
    gzmsg << "camera: " << _msg->name() << "\n";
    gzmsg << "\timage size: " << msgs::ConvertIgn(_msg->camera().image_size())
      << "\n";
    gzmsg << "\tpose: " << msgs::ConvertIgn(_msg->pose()) << "\n";
  }
}

The sensor message is described here: https://bitbucket.org/osrf/gazebo/src/8afec0e739b451a841f8b09dad6bb6c4c05c4d86/gazebo/msgs/sensor.proto?at=default&fileviewer=file-view-default
The content of its camera parameter is described here: https://bitbucket.org/osrf/gazebo/src/8afec0e739b451a841f8b09dad6bb6c4c05c4d86/gazebo/msgs/camerasensor.proto?at=default&fileviewer=file-view-default

You can also retrieve the camera lens parameters published on its lens/info topic with parrot-gz:
parrot-gz topic -e "~/bebop2/body/horizontal_camera/lens/info"


#3

It seems like CameraSensor message does not have intrinsic camera matrix that I am looking for. I thought, maybe your last paragraph would help, but I could not find neither the parrot-gz command nor any lens related topics with a simple gz topic -l. Would you give me a tipp about what I am doing wrong?


#4

parrot-gz is just an alias for gz. You can only see lens/info topics for wide-angle cameras (sensors with type wideanglecamera) like the front camera of Bebop 2.

The feature you request is not available in sphinx and is currently under review in gazebo: https://bitbucket.org/osrf/gazebo/pull-requests/2058/added-camera-intrinsics-fx-fy-cx-cy-s/diff