43 : m_newPacketReceivedCallbackFunction(newPacketReceivedCallbackFunction)
45 ROS_INFO(
"Starting SickSafetyscanners");
52 m_async_udp_client_ptr
55 ROS_INFO(
"Started SickSafetyscanners");
109 std::vector<sick::datastructure::FieldData>& field_data)
120 std::vector<sick::datastructure::MonitoringCaseData>& monitoring_cases)
130 std::string& device_name)
151 std::shared_ptr<sick::communication::AsyncTCPClient> async_tcp_client =
152 std::make_shared<sick::communication::AsyncTCPClient>(
157 async_tcp_client->doConnect();
160 m_session_ptr = std::make_shared<sick::cola2::Cola2Session>(async_tcp_client);
169 std::make_shared<sick::cola2::ChangeCommSettingsCommand>(boost::ref(*
m_session_ptr), settings);
174 std::vector<sick::datastructure::FieldData>& fields)
184 std::make_shared<sick::cola2::MeasurementCurrentConfigVariableCommand>(
192 for (
int i = 0; i < 128; i++)
196 command_ptr = std::make_shared<sick::cola2::FieldHeaderVariableCommand>(
200 if (field_data.getIsValid())
202 command_ptr = std::make_shared<sick::cola2::FieldGeometryVariableCommand>(
206 field_data.setStartAngleDegrees(config_data.
getStartAngle());
209 fields.push_back(field_data);
219 std::vector<sick::datastructure::MonitoringCaseData>& monitoring_cases)
222 for (
int i = 0; i < 254; i++)
226 command_ptr = std::make_shared<sick::cola2::MonitoringCaseVariableCommand>(
229 if (monitoring_case_data.getIsValid())
231 monitoring_cases.push_back(monitoring_case_data);
243 std::make_shared<sick::cola2::DeviceNameVariableCommand>(boost::ref(*
m_session_ptr),
246 ROS_INFO(
"Device name: %s", device_name.c_str());
252 std::make_shared<sick::cola2::TypeCodeVariableCommand>(boost::ref(*
m_session_ptr), type_code);
260 std::make_shared<sick::cola2::MeasurementPersistentConfigVariableCommand>(
float getStartAngle() const
Get the start angle of the configuration.
void requestFieldData(const sick::datastructure::CommSettings &settings, std::vector< sick::datastructure::FieldData > &field_data)
Requests data of the protective and warning fields from the sensor.
void requestMonitoringCases(const sick::datastructure::CommSettings &settings, std::vector< sick::datastructure::MonitoringCaseData > &monitoring_cases)
Requests the monitoring cases from the sensor.
void processUDPPacket(const datastructure::PacketBuffer &buffer)
A packetbuffer for the raw data from the sensor.
void requestDeviceNameInColaSession(std::string &device_name)
std::shared_ptr< sick::cola2::Command > CommandPtr
Typedef for a pointer containing a command to be executed.
void requestDeviceName(const sick::datastructure::CommSettings &settings, std::string &device_name)
Requests the name of the device from the sensor.
void changeCommSettingsInColaSession(const datastructure::CommSettings &settings)
void requestPersistentConfigInColaSession(sick::datastructure::ConfigData &config_data)
Field data for warning and protective fields.
Containing the communication settings for the sensor which can be changed on runtime.
std::shared_ptr< sick::communication::AsyncUDPClient > m_async_udp_client_ptr
The data class containing all data blocks of a measurement.
void changeSensorSettings(const sick::datastructure::CommSettings &settings)
Changes the internal settings of the sensor.
Parses the udp data packets depending on which data will be received.
void startTCPConnection(const sick::datastructure::CommSettings &settings)
bool parseUDPSequence(const sick::datastructure::PacketBuffer buffer, sick::datastructure::Data &data) const
Parses the udp data transferred in the packet buffer. It will be parsed into the data reference...
std::shared_ptr< boost::asio::io_service::work > m_io_work_ptr
uint16_t getSensorTcpPort() const
Gets the sensor tcp port.
SickSafetyscanners(packetReceivedCallbackFunction newPacketReceivedCallbackFunction, sick::datastructure::CommSettings *settings)
Constructor of the SickSafetyscanners class.
boost::asio::ip::address_v4 getSensorIp() const
Gets the sensor IP-address.
bool run()
Start the connection to the sensor and enables output.
std::shared_ptr< sick::cola2::Cola2Session > m_session_ptr
Config data for current and persistent sensor config.
void setHostUdpPort(const uint16_t &host_udp_port)
Sets the host udp port.
void requestPersistentConfig(const datastructure::CommSettings &settings, sick::datastructure::ConfigData &config_data)
Requests the persistent configuration from the sensor.
Stores the data for the different monitoring cases.
void requestTypeCode(const sick::datastructure::CommSettings &settings, sick::datastructure::TypeCode &type_code)
Requests the typecode of the sensor.
void requestFieldDataInColaSession(std::vector< sick::datastructure::FieldData > &fields)
packetReceivedCallbackFunction m_newPacketReceivedCallbackFunction
virtual ~SickSafetyscanners()
Destructor.
std::shared_ptr< boost::asio::io_service > m_io_service_ptr
void requestMonitoringCaseDataInColaSession(std::vector< sick::datastructure::MonitoringCaseData > &monitoring_cases)
void processTCPPacket(const sick::datastructure::PacketBuffer &buffer)
Class containing the type code of a laser scanner.
boost::scoped_ptr< boost::thread > m_udp_client_thread_ptr
uint16_t getHostUdpPort() const
Gets the host udp port.
std::shared_ptr< sick::data_processing::UDPPacketMerger > m_packet_merger_ptr
float getAngularBeamResolution() const
Returns the angular resolution between the beams.
void requestTypeCodeInColaSession(sick::datastructure::TypeCode &type_code)
boost::function< void(const sick::datastructure::Data &)> packetReceivedCallbackFunction