#include <cola_transmitter.h>
|
virtual bool | close (void) |
|
| ColaTransmitter (const std::string &server_adress="192.168.0.1", int tcp_port=2111, double default_receive_timeout=1) |
|
virtual bool | connect (void) |
|
virtual bool | receive (std::vector< uint8_t > &telegram, double timeout, ROS::Time &receive_timestamp) |
|
virtual bool | send (const std::vector< uint8_t > &data, ROS::Time &send_timestamp) |
|
virtual bool | startReceiverThread (void) |
|
virtual bool | stopReceiverThread (void) |
|
virtual bool | waitPopResponse (std::vector< uint8_t > &telegram, double timeout, ROS::Time &receive_timestamp) |
|
virtual | ~ColaTransmitter () |
|
|
static bool | receive (boost::asio::ip::tcp::socket &socket, std::vector< uint8_t > &telegram, double timeout, ROS::Time &receive_timestamp) |
|
static bool | send (boost::asio::ip::tcp::socket &socket, const std::vector< uint8_t > &data, ROS::Time &send_timestamp) |
|
|
static bool | dataEndWithETX (const std::vector< uint8_t > &data, const std::vector< uint8_t > &etx) |
|
Class sick_scan::ColaTransmitter connects to the localization controller and sends or receives cola telegrams. Base class for ColaSender and ColaReceiver.
Definition at line 68 of file cola_transmitter.h.
◆ ColaTransmitter()
sick_scan::ColaTransmitter::ColaTransmitter |
( |
const std::string & |
server_adress = "192.168.0.1" , |
|
|
int |
tcp_port = 2111 , |
|
|
double |
default_receive_timeout = 1 |
|
) |
| |
Constructor.
- Parameters
-
[in] | server_adress | ip adress of the localization controller, default: 192.168.0.1 |
[in] | tcp_port | tcp port for command requests, default: 2111 for command requests and 2112 for command responses |
[in] | default_receive_timeout | default timeout in seconds for receive functions |
Definition at line 74 of file cola_transmitter.cpp.
◆ ~ColaTransmitter()
sick_scan::ColaTransmitter::~ColaTransmitter |
( |
| ) |
|
|
virtual |
◆ close()
bool sick_scan::ColaTransmitter::close |
( |
void |
| ) |
|
|
virtual |
Closes the tcp connection to the localization server.
- Returns
- always true
Definition at line 104 of file cola_transmitter.cpp.
◆ connect()
bool sick_scan::ColaTransmitter::connect |
( |
void |
| ) |
|
|
virtual |
Connects to the localization server.
- Returns
- true on success, false on failure (localization server unknown or unreachable)
Definition at line 95 of file cola_transmitter.cpp.
◆ dataEndWithETX()
bool sick_scan::ColaTransmitter::dataEndWithETX |
( |
const std::vector< uint8_t > & |
data, |
|
|
const std::vector< uint8_t > & |
etx |
|
) |
| |
|
staticprotected |
Returns true, if data end with etx, i.e. the trailing (etx.size()) byte in data are identical to etx.
- Parameters
-
[in] | data | data received |
[in] | etx | ETX tag (binary or ascii) |
- Returns
- true if data end with etx, false otherwise
Definition at line 237 of file cola_transmitter.cpp.
◆ receive() [1/2]
bool sick_scan::ColaTransmitter::receive |
( |
boost::asio::ip::tcp::socket & |
socket, |
|
|
std::vector< uint8_t > & |
telegram, |
|
|
double |
timeout, |
|
|
ROS::Time & |
receive_timestamp |
|
) |
| |
|
static |
Receive a cola telegram from a socket.
- Parameters
-
[in] | socket | socket to read from |
[out] | telegram | telegram received (Cola-Binary or Cola-Ascii) |
[in] | timeout | timeout in seconds |
[out] | receive_timestamp | receive timestamp in seconds (ros timestamp immediately after first response byte received) |
- Returns
- true on success, false on failure (connection error or timeout)
Receive a cola telegram from a socket.
- Parameters
-
[in] | socket | socket to read from |
[out] | telegram | telegram received (Cola-Binary or Cola-Ascii) |
[in] | timeout | timeout in seconds |
[out] | receive_timestamp | receive timestamp in seconds (ros timestamp immediately after first response byte received) |
- Returns
- true on success, false on failure
Definition at line 179 of file cola_transmitter.cpp.
◆ receive() [2/2]
bool sick_scan::ColaTransmitter::receive |
( |
std::vector< uint8_t > & |
telegram, |
|
|
double |
timeout, |
|
|
ROS::Time & |
receive_timestamp |
|
) |
| |
|
virtual |
Receive a cola telegram from the localization server.
- Parameters
-
[out] | telegram | telegram received (Cola-Binary or Cola-Ascii) |
[in] | timeout | timeout in seconds |
[out] | receive_timestamp | receive timestamp in seconds (ros timestamp immediately after first response byte received) |
- Returns
- true on success, false on failure (connection error or timeout)
Receive a cola telegram from the localization server.
- Parameters
-
[out] | telegram | telegram received (Cola-Binary or Cola-Ascii) |
[in] | timeout | timeout in seconds |
[out] | receive_timestamp | receive timestamp in seconds (ros timestamp immediately after first response byte received) |
- Returns
- true on success, false on failure
Definition at line 166 of file cola_transmitter.cpp.
◆ runReceiverThreadCb()
void sick_scan::ColaTransmitter::runReceiverThreadCb |
( |
void |
| ) |
|
|
protected |
Thread callback, receives response telegrams from localization server and pushes them to m_response_fifo.
Definition at line 311 of file cola_transmitter.cpp.
◆ send() [1/2]
bool sick_scan::ColaTransmitter::send |
( |
boost::asio::ip::tcp::socket & |
socket, |
|
|
const std::vector< uint8_t > & |
data, |
|
|
ROS::Time & |
send_timestamp |
|
) |
| |
|
static |
Send data to the localization server.
- Parameters
-
[in] | socket | socket to write to |
[in] | data | data to be send |
[out] | send_timestamp | send timestamp in seconds (ros timestamp immediately before tcp send) |
- Returns
- true on success, false on failure
Definition at line 137 of file cola_transmitter.cpp.
◆ send() [2/2]
bool sick_scan::ColaTransmitter::send |
( |
const std::vector< uint8_t > & |
data, |
|
|
ROS::Time & |
send_timestamp |
|
) |
| |
|
virtual |
Send data to the localization server.
- Parameters
-
[in] | data | data to be send |
[out] | send_timestamp | send timestamp in seconds (ros timestamp immediately before tcp send) |
- Returns
- true on success, false on failure
Definition at line 125 of file cola_transmitter.cpp.
◆ startReceiverThread()
bool sick_scan::ColaTransmitter::startReceiverThread |
( |
void |
| ) |
|
|
virtual |
Starts a thread to receive response telegrams from the localization server. The receiver thread pushes responses to a fifo buffer, which can be popped by waitPopResponse().
- Returns
- always true
Definition at line 254 of file cola_transmitter.cpp.
◆ stopReceiverThread()
bool sick_scan::ColaTransmitter::stopReceiverThread |
( |
void |
| ) |
|
|
virtual |
Stops the thread to receive response telegrams from the localization server (if a thread has been started by startReceiverThread=.
- Returns
- always true
Definition at line 266 of file cola_transmitter.cpp.
◆ waitPopResponse()
bool sick_scan::ColaTransmitter::waitPopResponse |
( |
std::vector< uint8_t > & |
telegram, |
|
|
double |
timeout, |
|
|
ROS::Time & |
receive_timestamp |
|
) |
| |
|
virtual |
Returns a response telegram from the localization server. This function waits with timout, until the receiver thread received a response telegram from the localization server. Note: The receiver thread must have been started by startReceiverThread(), otherwise waitPopResponse() will fail after timout.
- Parameters
-
[out] | telegram | telegram received (Cola-Binary or Cola-Ascii) |
[in] | timeout | timeout in seconds |
[out] | receive_timestamp | receive timestamp in seconds (ros timestamp immediately after first response byte received) |
- Returns
- true on success, false on failure (connection error or timeout)
Definition at line 288 of file cola_transmitter.cpp.
◆ m_ioservice
boost::asio::io_service sick_scan::ColaTransmitter::m_ioservice |
|
protected |
◆ m_receive_timeout
double sick_scan::ColaTransmitter::m_receive_timeout |
|
protected |
◆ m_receiver_thread
boost::thread* sick_scan::ColaTransmitter::m_receiver_thread |
|
protected |
◆ m_receiver_thread_running
bool sick_scan::ColaTransmitter::m_receiver_thread_running |
|
protected |
◆ m_response_fifo
fifo buffer for receiver thread for responses from localization server
Definition at line 197 of file cola_transmitter.h.
◆ m_server_adress
std::string sick_scan::ColaTransmitter::m_server_adress |
|
protected |
ip adress of the localization controller, default: 192.168.0.1
Definition at line 190 of file cola_transmitter.h.
◆ m_tcp_port
int sick_scan::ColaTransmitter::m_tcp_port |
|
protected |
tcp port of the localization controller, default: 2111 for command requests and 2112 for command responses
Definition at line 191 of file cola_transmitter.h.
◆ m_tcp_socket
The documentation for this class was generated from the following files: