#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.
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.
sick_scan::ColaTransmitter::~ColaTransmitter |
( |
| ) |
|
|
virtual |
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
boost::asio::io_service sick_scan::ColaTransmitter::m_ioservice |
|
protected |
double sick_scan::ColaTransmitter::m_receive_timeout |
|
protected |
boost::thread* sick_scan::ColaTransmitter::m_receiver_thread |
|
protected |
bool sick_scan::ColaTransmitter::m_receiver_thread_running |
|
protected |
fifo buffer for receiver thread for responses from localization server
Definition at line 197 of file cola_transmitter.h.
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.
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.
The documentation for this class was generated from the following files: