SonarSensor.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_SONARSENSOR_HH_
18#define _GAZEBO_SENSORS_SONARSENSOR_HH_
19
20#include <memory>
21#include <string>
22
24#include "gazebo/util/system.hh"
25
26namespace gazebo
27{
30 namespace sensors
31 {
32 // Forward declare private data class.
33 class SonarSensorPrivate;
34
37
42 class GZ_SENSORS_VISIBLE SonarSensor: public Sensor
43 {
45 public: SonarSensor();
46
48 public: virtual ~SonarSensor();
49
50 // Documentation inherited
51 public: virtual void Load(const std::string &_worldName);
52
53 // Documentation inherited
54 public: virtual void Init();
55
56 // Documentation inherited
57 public: virtual std::string Topic() const;
58
61 public: double RangeMin() const;
62
65 public: double RangeMax() const;
66
69 public: double Radius() const;
70
73 public: std::string Geometry() const;
74
83 public: double Range();
84
85
86 // Documentation inherited
87 public: virtual bool IsActive() const;
88
93 std::function<void (msgs::SonarStamped)> _subscriber);
94
95 // Documentation inherited
96 protected: virtual bool UpdateImpl(const bool _force);
97
98 // Documentation inherited
99 protected: virtual void Fini();
100
102 private: void OnContacts(ConstContactsPtr &_msg);
103
106 private: std::unique_ptr<SonarSensorPrivate> dataPtr;
107 };
109 }
110}
111#endif
sensors
Definition SensorManager.hh:35
Base class for sensors.
Definition Sensor.hh:53
Sensor with sonar cone.
Definition SonarSensor.hh:43
double Radius() const
Get the radius of the sonar cone at maximum range.
double RangeMax() const
Get the minimum range of the sonar.
virtual void Fini()
Finalize the sensor.
virtual void Init()
Initialize the sensor.
double RangeMin() const
Get the minimum range of the sonar.
virtual void Load(const std::string &_worldName)
Load the sensor with default parameters.
std::string Geometry() const
Get the sonar collision shape.
virtual bool IsActive() const
Returns true if sensor generation is active.
virtual std::string Topic() const
Returns the topic name as set in SDF.
virtual bool UpdateImpl(const bool _force)
This gets overwritten by derived sensor types.
virtual ~SonarSensor()
Destructor.
event::ConnectionPtr ConnectUpdate(std::function< void(msgs::SonarStamped)> _subscriber)
Connect a to the new update signal.
double Range()
Get detected range for a sonar.
boost::shared_ptr< Connection > ConnectionPtr
Definition CommonTypes.hh:134
Forward declarations for the common classes.
Definition Animation.hh:27