35 const nav_msgs::OccupancyGrid& map,
36 const stdr_msgs::SoundSensorMsg& msg,
37 const std::string& name,
39 :
Sensor(map, name, n, msg.pose, msg.frame_id, msg.frequency)
47 "stdr_server/sound_sources_list",
70 stdr_msgs::SoundSensorMeasurementMsg measuredSourcesMsg;
72 measuredSourcesMsg.header.frame_id =
_description.frame_id;
73 measuredSourcesMsg.sound_dbs = 0;
77 float min_angle = sensor_th -
_description.angleSpan / 2.0;
78 float max_angle = sensor_th +
_description.angleSpan / 2.0;
81 for(
unsigned int i = 0 ; i <
sound_sources_.sound_sources.size() ; i++)
107 measuredSourcesMsg.sound_dbs +=
sound_sources_.sound_sources[i].dbs *
108 pow(0.5, 2) / pow(dist, 2);
112 measuredSourcesMsg.sound_dbs +=
sound_sources_.sound_sources[i].dbs;
117 measuredSourcesMsg.header.frame_id =
SoundSensor(const nav_msgs::OccupancyGrid &map, const stdr_msgs::SoundSensorMsg &msg, const std::string &name, ros::NodeHandle &n)
Default constructor.
const std::string & _namespace
< The base for the sensor frame_id
void publish(const boost::shared_ptr< M > &message) const
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
The main namespace for STDR Robot.
static double getYaw(const Quaternion &bt_q)
A class that provides sensor abstraction.
void receiveSoundSources(const stdr_msgs::SoundSourceVector &msg)
Receives the existent sound sources.
TFSIMD_FORCE_INLINE const tfScalar & x() const
tf::StampedTransform _sensorTransform
True if sensor got the _sensorTransform.
TFSIMD_FORCE_INLINE const tfScalar & y() const
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
stdr_msgs::SoundSensorMsg _description
< sound sensor description
static bool angCheck(float target_, float min_, float max_)
Checks if an angle is between two others. Supposes that min < max.
ros::Subscriber sound_sources_subscriber_
The currently existent sources.
~SoundSensor(void)
Default destructor.
virtual void updateSensorCallback()
Updates the sensor measurements.
stdr_msgs::SoundSourceVector sound_sources_
ros::Publisher _publisher
ROS tf listener.