28 #include <boost/shared_ptr.hpp> 29 #include <boost/make_shared.hpp> 30 #include <boost/asio.hpp> 42 using boost::make_shared;
43 using boost::asio::buffer;
89 throw std::invalid_argument(
"Start angle is greater than max");
93 throw std::invalid_argument(
"End angle is greater than max");
97 throw std::invalid_argument(
"Starting angle is less than ending angle");
106 int start_byte = start_beam / 8;
107 int start_bit = start_beam - start_byte * 8;
108 int end_byte = end_beam / 8;
109 int end_bit = end_beam - end_byte * 8;
114 memset(mask, 0, start_byte);
121 mask[start_byte] = ~((1 << start_bit) - 1);
129 memset(mask + start_byte + 1, 0xFF, end_byte - start_byte - 1);
132 mask[end_byte] = (1 << (end_bit + 1)) - 1;
135 memset(mask + end_byte + 1, 0, 87 - end_byte);
165 throw std::invalid_argument(
"Number of beams does not match vector size");
201 throw std::invalid_argument(
"Number of beams does not match vector size");
249 throw std::logic_error(
"IO Packet received with wrong number of items");
251 if (pkt.
getItems()[1].getItemType() != 0x00B1)
253 throw std::logic_error(
"IO Packet received with wrong data type");
266 o_to_t.
rpi = 0x00177FA0;
269 t_to_o.
rpi = 0x00013070;
MeasurementReportConfig mrc_
static const double ANGLE_INC
void selectBeams(double start_angle, double end_angle)
CPFPacket receiveIOPacket()
vector< EIP_UINT > measurement_data
EIP_UINT getReflectivityFormat()
static const double ANGLE_MAX
RangeAndReflectanceMeasurement getSingleRRScan()
void closeConnection(size_t n)
vector< EIP_UINT > reflectance_data
static int calcBeamNumber(double angle)
void setReflectivityFormat(EIP_UINT format)
void sendIOPacket(CPFPacket &pkt)
void setRangeFormat(EIP_UINT format)
void closeActiveConnection()
EIP_UINT getRangeFormat()
EIP_BYTE beam_selection_mask[88]
EIP_UDINT o_to_t_connection_id
EIP_UINT range_report_format
MeasurementReportHeader header
static double calcBeamCentre(int beam_num)
void setSingleAttributeSerializable(EIP_USINT class_id, EIP_USINT instance_id, EIP_USINT attribute_id, shared_ptr< Serializable > data)
static const double DISTANCE_MAX
int createConnection(const EIP_CONNECTION_INFO_T &o_to_t, const EIP_CONNECTION_INFO_T &t_to_o)
void setSingleAttribute(EIP_USINT class_id, EIP_USINT instance_id, EIP_USINT attribute_id, T v)
void calcBeamMask(double start_angle, double end_angle, EIP_BYTE mask[])
MeasurementReport receiveMeasurementReportUDP()
MeasurementReportHeader header
const Connection & getConnection(size_t n)
EIP_UDINT mrc_sequence_num_
static const double ANGLE_MIN
static void convertToLaserScan(const RangeAndReflectanceMeasurement &rr, sensor_msgs::LaserScan *ls)
void sendMeasurmentReportConfigUDP()
void fillLaserScanStaticConfig(sensor_msgs::LaserScan *ls)
T getSingleAttribute(EIP_USINT class_id, EIP_USINT instance_id, EIP_USINT attribute_id, T v)
vector< CPFItem > & getItems()
static const double DISTANCE_MIN
void getSingleAttributeSerializable(EIP_USINT class_id, EIP_USINT instance_id, EIP_USINT attribute_id, Serializable &result)
EIP_UINT reflectivity_report_format
vector< EIP_UINT > range_data
EIP_UINT getItemCount() const