16 #ifndef PSEN_SCAN_V2_ZONESET_CONFIGURATION_ROS_CONVERSION_H 17 #define PSEN_SCAN_V2_ZONESET_CONFIGURATION_ROS_CONVERSION_H 21 #include <geometry_msgs/Polygon.h> 24 #include "psen_scan_v2/ZoneSet.h" 25 #include "psen_scan_v2/ZoneSetConfiguration.h" 37 return deg * M_PI / 180.0;
40 geometry_msgs::Polygon
fromPolar(
const std::vector<unsigned long>& radii_in_mm,
42 const double& x_axis_rotation)
44 geometry_msgs::Polygon polygon;
46 for (
const auto&
r : radii_in_mm)
48 geometry_msgs::Point32 point;
50 const auto angle = phi_step.
toRad() * i - x_axis_rotation;
51 point.x = (
r / 1000.) * std::cos(
angle);
52 point.y = (
r / 1000.) * std::sin(
angle);
55 polygon.points.push_back(point);
64 const std::string& frame_id,
86 return zoneset_msg_builder.
build();
90 const std::string& frame_id,
93 psen_scan_v2::ZoneSetConfiguration zoneset_config_msg;
95 for (
const auto& z : zoneset_configuration.
zonesets_)
97 zoneset_config_msg.zonesets.push_back(
toRosMsg(z, frame_id, stamp));
99 return zoneset_config_msg;
102 #endif // PSEN_SCAN_V2_ZONESET_CONFIGURATION_ROS_CONVERSION_H
ZoneSetMsgBuilder & headerFrameId(const std::string &header_frame_id)
ZoneSetMsgBuilder & muting2(const geometry_msgs::Polygon &muting2)
ZoneSetMsgBuilder & safety2(const geometry_msgs::Polygon &safety2)
ZoneSetMsgBuilder & headerStamp(const ros::Time &header_stamp)
std::vector< unsigned long > safety3_
ZoneSetMsgBuilder & speedUpper(const float &speed_upper)
std::vector< unsigned long > safety2_
ZoneSetMsgBuilder & safety1(const geometry_msgs::Polygon &safety1)
boost::optional< ZoneSetSpeedRange > speed_range_
TFSIMD_FORCE_INLINE tfScalar angle(const Quaternion &q1, const Quaternion &q2)
psen_scan_v2_standalone::util::TenthOfDegree TenthOfDegree
ZoneSetMsgBuilder & speedLower(const float &speed_lower)
ZoneSetMsgBuilder & muting1(const geometry_msgs::Polygon &muting1)
ZoneSetMsgBuilder & warn2(const geometry_msgs::Polygon &warn2)
static constexpr double DEFAULT_X_AXIS_ROTATION
The 2D scan will be rotated around the z-axis.
constexpr double toRad() const
std::vector< unsigned long > safety1_
std::vector< unsigned long > warn1_
std::vector< unsigned long > muting1_
A set of simultanously active zones.
std::vector< unsigned long > muting2_
util::TenthOfDegree resolution_
static double deg_to_rad(double deg)
ZoneSetMsgBuilder & safety3(const geometry_msgs::Polygon &safety3)
psen_scan_v2::ZoneSet toRosMsg(const ZoneSetStandalone &zoneset, const std::string &frame_id, const ros::Time &stamp=ros::Time::now())
ZoneSetMsgBuilder & warn1(const geometry_msgs::Polygon &warn1)
std::vector< unsigned long > warn2_
std::vector< ZoneSet > zonesets_
geometry_msgs::Polygon fromPolar(const std::vector< unsigned long > &radii_in_mm, const TenthOfDegree &phi_step, const double &x_axis_rotation)
Helper class representing angles in tenth of degree.