MultiCameraSensor.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16*/
17#ifndef _GAZEBO_SENSORS_MULTICAMERASENSOR_HH_
18#define _GAZEBO_SENSORS_MULTICAMERASENSOR_HH_
19
20#include <memory>
21#include <string>
22#include <vector>
23
24#include "gazebo/msgs/MessageTypes.hh"
28#include "gazebo/util/system.hh"
29
30namespace gazebo
31{
32 namespace sensors
33 {
34 // Forward declare private data class.
35 class MultiCameraSensorPrivate;
36
40
44 class GZ_SENSORS_VISIBLE MultiCameraSensor : public Sensor
45 {
48
50 public: virtual ~MultiCameraSensor();
51
52 // Documentation inherited
53 public: virtual void Load(const std::string &_worldName);
54
55 // Documentation inherited
56 public: virtual void Init();
57
58 // Documentation inherited
59 public: virtual std::string Topic() const;
60
63 public: unsigned int CameraCount() const;
64
70 public: rendering::CameraPtr Camera(const unsigned int _index) const;
71
76 public: unsigned int ImageWidth(const unsigned int _index) const;
77
82 public: unsigned int ImageHeight(const unsigned int _index) const;
83
88 public: const unsigned char *ImageData(const unsigned int _index);
89
94 public: bool SaveFrame(const std::vector<std::string> &_filenames);
95
96 // Documentation inherited.
97 public: virtual bool IsActive() const;
98
99 // Documentation inherited.
100 protected: virtual bool UpdateImpl(const bool _force);
101
102 // Documentation inherited.
103 protected: virtual void Fini();
104
106 private: void Render();
107
110 private: std::unique_ptr<MultiCameraSensorPrivate> dataPtr;
111 };
113 }
114}
115#endif
sensors
Definition SensorManager.hh:35
Forward declarations for transport.
Multiple camera sensor.
Definition MultiCameraSensor.hh:45
virtual void Fini()
Finalize the sensor.
virtual void Init()
Initialize the sensor.
virtual void Load(const std::string &_worldName)
Load the sensor with default parameters.
const unsigned char * ImageData(const unsigned int _index)
Gets the raw image data from the sensor.
virtual bool IsActive() const
Returns true if sensor generation is active.
virtual std::string Topic() const
Returns the topic name as set in SDF.
unsigned int CameraCount() const
Get the number of cameras.
bool SaveFrame(const std::vector< std::string > &_filenames)
Saves the camera image(s) to the disk.
unsigned int ImageWidth(const unsigned int _index) const
Gets the width of the image in pixels.
virtual bool UpdateImpl(const bool _force)
This gets overwritten by derived sensor types.
virtual ~MultiCameraSensor()
Destructor.
unsigned int ImageHeight(const unsigned int _index) const
Gets the height of the image in pixels.
rendering::CameraPtr Camera(const unsigned int _index) const
Returns a pointer to a rendering::Camera.
Base class for sensors.
Definition Sensor.hh:53
boost::shared_ptr< Camera > CameraPtr
Definition RenderTypes.hh:90
Forward declarations for the common classes.
Definition Animation.hh:27