1 #ifndef SLAM_CTOR_ROS_LASER_SCAN_OBSERVER_H_INCLUDED 2 #define SLAM_CTOR_ROS_LASER_SCAN_OBSERVER_H_INCLUDED 6 #include <sensor_msgs/LaserScan.h> 7 #include <boost/shared_ptr.hpp> 11 #include "../core/states/state_data.h" 12 #include "../core/states/robot_pose.h" 13 #include "../core/states/world.h" 14 #include "../core/states/sensor_data.h" 19 using DstPtr = std::shared_ptr<SensorDataObserver<TransformedLaserScan>>;
35 transformed_scan.
scan.
points().reserve(msg->ranges.size());
40 double sp_angle = msg->angle_min - msg->angle_increment;
41 for (
const auto &range : msg->ranges) {
42 bool sp_is_occupied =
true;
43 double sp_range = range;
44 sp_angle += msg->angle_increment;
47 if (sp_range < msg->range_min) {
49 }
else if (msg->range_max <= sp_range) {
50 sp_is_occupied =
false;
51 sp_range = msg->range_max;
58 transformed_scan.
scan.
points().emplace_back(sp_range, sp_angle,
61 assert(
are_equal(sp_angle, msg->angle_max));
64 _prev_pose = new_pose;
66 _slam->handle_sensor_data(transformed_scan);
76 auto provider = std::make_shared<CachedTrigonometryProvider>();
77 provider->update(msg->angle_min, msg->angle_max + msg->angle_increment,
78 msg->angle_increment);
81 return std::make_shared<RawTrigonometryProvider>();
CONSTEXPR bool are_equal(const T &a, const T &b, const T &eps)
static double getYaw(const Quaternion &bt_q)
TFSIMD_FORCE_INLINE const tfScalar & getY() const
bool _use_cached_trig_provider
const RobotPose & odometry_pose() const
const Points & points() const
std::shared_ptr< TrigonometryProvider > trig_provider
std::shared_ptr< TrigonometryProvider > trig_provider(const ScanPtr msg)
std::shared_ptr< SensorDataObserver< TransformedLaserScan >> DstPtr
void set_odometry_pose(const RobotPose &pose)
TFSIMD_FORCE_INLINE const tfScalar & getX() const
virtual void handle_transformed_msg(const ScanPtr msg, const tf::StampedTransform &t)
LaserScanObserver(DstPtr slam, bool skip_max_vals, bool use_cached_trig)