15#ifndef SEMANTIC_COMPONENTS__RANGE_SENSOR_HPP_
16#define SEMANTIC_COMPONENTS__RANGE_SENSOR_HPP_
21#include "semantic_components/semantic_component_interface.hpp"
22#include "sensor_msgs/msg/range.hpp"
24namespace semantic_components
26class RangeSensor :
public SemanticComponentInterface<sensor_msgs::msg::Range>
29 explicit RangeSensor(
const std::string & name)
30 : SemanticComponentInterface(name, {name +
"/" +
"range"})
40 const auto data = state_interfaces_[0].get().get_optional();
43 return static_cast<float>(data.value());
45 return std::numeric_limits<float>::quiet_NaN();
bool get_values_as_message(sensor_msgs::msg::Range &message) const
Return Range message with range in meters.
Definition range_sensor.hpp:55
float get_range() const
Return Range reported by a sensor.
Definition range_sensor.hpp:38