20 #include <gazebo/sensors/Sensor.hh> 21 #include <gazebo/sensors/MultiCameraSensor.hh> 22 #include <gazebo/sensors/SensorTypes.hh> 29 GZ_REGISTER_SENSOR_PLUGIN(GazeboRosTriggeredMultiCamera)
51 ROS_FATAL_STREAM(
"A ROS node for Gazebo has not been initialized, unable to load plugin. " 52 <<
"Load the Gazebo system plugin 'libgazebo_ros_api_plugin.so' in the gazebo_ros package)");
62 for (
unsigned i = 0; i < this->
camera.size(); ++i)
75 if (this->
camera[i]->Name().find(
"left") != std::string::npos)
78 cam->
Load(_parent, _sdf,
"/left", 0.0);
80 else if (this->
camera[i]->Name().find(
"right") != std::string::npos)
82 double hackBaseline = 0.0;
83 if (_sdf->HasElement(
"hackBaseline"))
84 hackBaseline = _sdf->Get<
double>(
"hackBaseline");
85 cam->
Load(_parent, _sdf,
"/right", hackBaseline);
94 unsigned int _width,
unsigned int _height,
unsigned int _depth,
95 const std::string &_format)
98 cam->
OnNewFrame(_image, _width, _height, _depth, _format);
104 unsigned int _width,
unsigned int _height,
unsigned int _depth,
105 const std::string &_format)
108 cam->
OnNewFrame(_image, _width, _height, _depth, _format);
std::vector< rendering::CameraPtr > camera
ROSCPP_DECL bool isInitialized()
boost::shared_ptr< bool > was_active_
Keep track when we activate this camera through ros subscription, was it already active? resume state when unsubscribed.
std::vector< GazeboRosTriggeredCamera * > triggered_cameras
std::vector< unsigned int > width
boost::shared_ptr< int > image_connect_count_
Keep track of number of image connections.
sensors::MultiCameraSensorPtr parentSensor
#define ROS_FATAL_STREAM(args)
void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf)
Load the plugin.
boost::shared_ptr< bool > was_active_
virtual void Load(sensors::SensorPtr _sensor, sdf::ElementPtr _sdf)
void Load(sensors::SensorPtr _parent, sdf::ElementPtr _sdf)
Load the plugin.
boost::shared_ptr< boost::mutex > image_connect_count_lock_
boost::shared_ptr< int > image_connect_count_
virtual void OnNewFrame(const unsigned char *_image, unsigned int _width, unsigned int _height, unsigned int _depth, const std::string &_format)
Update the controller.
std::vector< unsigned int > depth
rendering::CameraPtr camera_
std::vector< unsigned int > height
virtual void OnNewFrameRight(const unsigned char *_image, unsigned int _width, unsigned int _height, unsigned int _depth, const std::string &_format)
virtual void OnNewFrameLeft(const unsigned char *_image, unsigned int _width, unsigned int _height, unsigned int _depth, const std::string &_format)
Update the controller FIXME: switch to function vectors.
std::vector< std::string > format
sensors::SensorPtr parentSensor_
~GazeboRosTriggeredMultiCamera()
Destructor.
boost::shared_ptr< boost::mutex > image_connect_count_lock_
A mutex to lock access to image_connect_count_.