SickSafetyscanners.h
Go to the documentation of this file.
1 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2 
3 // -- BEGIN LICENSE BLOCK ----------------------------------------------
4 
24 // -- END LICENSE BLOCK ------------------------------------------------
25 
26 //----------------------------------------------------------------------
33 //----------------------------------------------------------------------
34 
35 #ifndef SICK_SAFETYSCANNERS_SICKSAFETYSCANNERS_H
36 #define SICK_SAFETYSCANNERS_SICKSAFETYSCANNERS_H
37 
38 #include <ros/ros.h>
39 
40 #include <boost/function.hpp>
41 #include <boost/scoped_ptr.hpp>
42 #include <boost/thread.hpp>
43 
44 #include <iostream>
45 #include <string>
46 #include <vector>
47 
55 
66 
67 namespace sick {
68 
73 {
74 public:
79  typedef boost::function<void(const sick::datastructure::Data&)> packetReceivedCallbackFunction;
80 
87  SickSafetyscanners(packetReceivedCallbackFunction newPacketReceivedCallbackFunction,
89 
93  virtual ~SickSafetyscanners();
94 
99  bool run();
100 
106 
113  sick::datastructure::TypeCode& type_code);
114 
122  std::vector<sick::datastructure::FieldData>& field_data);
123 
131  std::string& device_name);
132 
140  sick::datastructure::ConfigData& config_data);
147  void
149  std::vector<sick::datastructure::MonitoringCaseData>& monitoring_cases);
150 
151 
152 private:
153  packetReceivedCallbackFunction m_newPacketReceivedCallbackFunction;
154 
155  std::shared_ptr<boost::asio::io_service> m_io_service_ptr;
156  std::shared_ptr<boost::asio::io_service::work> m_io_work_ptr;
157  std::shared_ptr<sick::communication::AsyncUDPClient> m_async_udp_client_ptr;
158  std::shared_ptr<sick::communication::AsyncTCPClient> m_async_tcp_client_ptr;
159  boost::scoped_ptr<boost::thread> m_udp_client_thread_ptr;
160 
161  std::shared_ptr<sick::cola2::Cola2Session> m_session_ptr;
162 
163  std::shared_ptr<sick::data_processing::UDPPacketMerger> m_packet_merger_ptr;
164 
165  std::string m_device_name;
167 
168  void processUDPPacket(const datastructure::PacketBuffer& buffer);
169  bool UDPClientThread();
173  void stopTCPConnection();
175  void requestFieldDataInColaSession(std::vector<sick::datastructure::FieldData>& fields);
176  void requestDeviceNameInColaSession(std::string& device_name);
179  std::vector<sick::datastructure::MonitoringCaseData>& monitoring_cases);
180 };
181 
182 } // namespace sick
183 
184 
185 #endif // SICK_SAFETYSCANNERS_SICKSAFETYSCANNERS_H
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.
Definition: PacketBuffer.h:61
void requestDeviceNameInColaSession(std::string &device_name)
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)
Containing the communication settings for the sensor which can be changed on runtime.
Definition: CommSettings.h:48
std::shared_ptr< sick::communication::AsyncUDPClient > m_async_udp_client_ptr
void changeSensorSettings(const sick::datastructure::CommSettings &settings)
Changes the internal settings of the sensor.
Class managing the algorithmic part of the package.
void startTCPConnection(const sick::datastructure::CommSettings &settings)
std::shared_ptr< boost::asio::io_service::work > m_io_work_ptr
SickSafetyscanners(packetReceivedCallbackFunction newPacketReceivedCallbackFunction, sick::datastructure::CommSettings *settings)
Constructor of the SickSafetyscanners class.
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.
Definition: ConfigData.h:48
void requestPersistentConfig(const datastructure::CommSettings &settings, sick::datastructure::ConfigData &config_data)
Requests the persistent configuration from the sensor.
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
std::shared_ptr< boost::asio::io_service > m_io_service_ptr
virtual ~SickSafetyscanners()
Destructor.
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.
Definition: TypeCode.h:62
boost::scoped_ptr< boost::thread > m_udp_client_thread_ptr
std::shared_ptr< sick::data_processing::UDPPacketMerger > m_packet_merger_ptr
void requestTypeCodeInColaSession(sick::datastructure::TypeCode &type_code)
std::shared_ptr< sick::communication::AsyncTCPClient > m_async_tcp_client_ptr
boost::function< void(const sick::datastructure::Data &)> packetReceivedCallbackFunction


sick_safetyscanners
Author(s): Lennart Puck
autogenerated on Thu May 9 2019 02:41:08