29 #include "gazebo/common/Plugin.hh" 30 #include <gazebo/msgs/msgs.hh> 31 #include "gazebo/sensors/CameraSensor.hh" 32 #include "gazebo/rendering/Camera.hh" 33 #include "gazebo/util/system.hh" 35 #include "camera_utils_request.pb.h" 36 #include "camera_utils_response.pb.h" 40 #include <boost/filesystem.hpp> 48 #define REQUEST_TOPIC "~/gap/camera_utils" 49 #define RESPONSE_TOPIC "~/gap/camera_utils/response" 53 #define MOVE_REQUEST gap::msgs::CameraUtilsRequest::MOVE 54 #define MOVE_RESPONSE gap::msgs::CameraUtilsResponse::MOVE 56 #define CAPTURE_REQUEST gap::msgs::CameraUtilsRequest::CAPTURE 58 #define CAPTURE_RESPONSE gap::msgs::CameraUtilsResponse::CAPTURE 60 #define OPTIONS_REQUEST gap::msgs::CameraUtilsRequest::OPTIONS 62 #define PROJECTION_REQUEST gap::msgs::CameraUtilsRequest::PROJECTION 64 #define PROJECTION_RESPONSE gap::msgs::CameraUtilsResponse::PROJECTION 70 #define DEFAULT_OUTPUT_DIR (const std::string) "/tmp/camera_utils_output/" 71 #define DEFAULT_EXTENSION (const std::string) ".png" 79 typedef const boost::shared_ptr<const gap::msgs::CameraUtilsRequest>
82 typedef const boost::shared_ptr<const gap::msgs::CameraUtilsResponse>
110 private: std::unique_ptr<CameraUtilsPrivate>
dataPtr;
114 private:
int saved_counter {0};
118 private:
bool save_on_update {
false};
150 public:
virtual void Load(sensors::SensorPtr _sensor, sdf::ElementPtr _sdf);
158 public:
void OnNewFrame(
const unsigned char *_image,
159 unsigned int _width,
unsigned int _height,
160 unsigned int _depth,
const std::string &_format);
Definition: CameraUtils.cc:30
Class for private camera utils plugin data.
Definition: CameraUtils.cc:34
const boost::shared_ptr< const gap::msgs::CameraUtilsResponse > CameraUtilsReplyPtr
Shared pointer declaration for response message type.
Definition: CameraUtils.hh:83
event::ConnectionPtr newFrameConnection
Connects to new frame rendered event.
Definition: CameraUtils.hh:120
std::string format
Image format.
Definition: CameraUtils.hh:135
std::string extension
Exported image extension.
Definition: CameraUtils.hh:137
const boost::shared_ptr< const gap::msgs::CameraUtilsRequest > CameraUtilsRequestPtr
Shared pointer declaration for request message type.
Definition: CameraUtils.hh:80
std::string output_dir
Directory for saving output.
Definition: CameraUtils.hh:112
unsigned int depth
Image depth.
Definition: CameraUtils.hh:133
unsigned int width
Image width.
Definition: CameraUtils.hh:129
std::unique_ptr< CameraUtilsPrivate > dataPtr
Class with private attributes.
Definition: CameraUtils.hh:110
std::string next_file_name
File name for next capture.
Definition: CameraUtils.hh:116
sensors::CameraSensorPtr parentSensor
Pointer to camera sensor.
Definition: CameraUtils.hh:125
Definition: CameraUtils.hh:45
rendering::CameraPtr camera
Pointer to camera object.
Definition: CameraUtils.hh:127
unsigned int height
Image height.
Definition: CameraUtils.hh:131