Commit 79382fc4 authored by fmg005's avatar fmg005

Amended connection debug messages and comments

parent 70b40bee
...@@ -6,10 +6,10 @@ tcp_monitor_client::tcp_monitor_client(std::shared_ptr<CLA::LOGGER>& logger, ...@@ -6,10 +6,10 @@ tcp_monitor_client::tcp_monitor_client(std::shared_ptr<CLA::LOGGER>& logger,
const string& topic, const string& type): m_topic(move(topic)), m_type(move(type)), const string& topic, const string& type): m_topic(move(topic)), m_type(move(type)),
m_logger(logger) { m_logger(logger) {
/* we can only talk to rosbrige server using json strings; here we want to /* we can only talk to rosbrige server using json strings; here we want to
* `publish` to `monitor topic` -> messages of type `std_msgs/String` * `publish` to `monitor topic` -> messages of type `std_msgs/Float64`
*/ */
json_message = "{\"op\":\"advertise\", \"topic\": \""+m_topic+"\", \"type\": \""+m_type+"\"}"; json_message = "{\"op\":\"advertise\", \"topic\": \""+m_topic+"\", \"type\": \""+m_type+"\"}";
m_host = "cmdmaster"; /* rosbridge server runs on localhost */ m_host = "cmdmaster"; /* rosbridge server hostname */
port = 9090; /* rosbridge server uses this port number */ port = 9090; /* rosbridge server uses this port number */
SOCKET_TIMEOUT_SEC = 0; SOCKET_TIMEOUT_SEC = 0;
SOCKET_TIMEOUT_uSEC = 500000;/* block for 0.5s */ SOCKET_TIMEOUT_uSEC = 500000;/* block for 0.5s */
...@@ -18,7 +18,7 @@ m_logger(logger) { ...@@ -18,7 +18,7 @@ m_logger(logger) {
void tcp_monitor_client::setup_connection() { void tcp_monitor_client::setup_connection() {
/* create a TCP socket */ /* create a TCP socket */
fd = socket(AF_INET, SOCK_STREAM, 0); fd = socket(AF_INET, SOCK_STREAM, 0);
m_logger->debug("Connecting to rosbridge server for monitor data ..."); m_logger->debug("Trying to connect to dummy monitor through rosbridge server");
if (fd < 0) { if (fd < 0) {
m_logger->error("Failed to create socket for publishing monitor data"); m_logger->error("Failed to create socket for publishing monitor data");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
......
...@@ -7,10 +7,10 @@ tcp_pump_client::tcp_pump_client(const string& topic, const string& type, \ ...@@ -7,10 +7,10 @@ tcp_pump_client::tcp_pump_client(const string& topic, const string& type, \
m_topic(move(topic)), m_type(move(type)), m_logger(logger), \ m_topic(move(topic)), m_type(move(type)), m_logger(logger), \
m_substance(substance) { m_substance(substance) {
/* we can only talk to rosbrige server using json strings; here we want to /* we can only talk to rosbrige server using json strings; here we want to
* 'subscribe' to 'chatter topic' publishing messages of type 'std_msgs/String' * 'subscribe' to 'chatter topic' publishing messages of type 'std_msgs/Float64'
*/ */
json_message = "{\"op\":\"subscribe\", \"topic\": \""+m_topic+"\", \"type\": \""+m_type+"\"}"; json_message = "{\"op\":\"subscribe\", \"topic\": \""+m_topic+"\", \"type\": \""+m_type+"\"}";
m_host = "cmdmaster"; /* rosbridge server runs on localhost */ m_host = "cmdmaster"; /* rosbridge server runs hostname */
port = 9090; /* rosbridge server uses this port number */ port = 9090; /* rosbridge server uses this port number */
SOCKET_TIMEOUT_SEC = 0; SOCKET_TIMEOUT_SEC = 0;
SOCKET_TIMEOUT_uSEC = 100000; /* 100 millisecond*/ SOCKET_TIMEOUT_uSEC = 100000; /* 100 millisecond*/
...@@ -23,7 +23,7 @@ tcp_pump_client::tcp_pump_client(const string& topic, const string& type, \ ...@@ -23,7 +23,7 @@ tcp_pump_client::tcp_pump_client(const string& topic, const string& type, \
void tcp_pump_client::setup_connection() { void tcp_pump_client::setup_connection() {
/* create a TCP socket */ /* create a TCP socket */
fd = socket(AF_INET, SOCK_STREAM, 0); fd = socket(AF_INET, SOCK_STREAM, 0);
m_logger->debug("Connecting to rosbridge server for "+m_substance+" pump data ..."); m_logger->debug("Trying to connect to "+m_substance+" pump through rosbridge server");
if (fd < 0) { if (fd < 0) {
m_logger->error("Failed to create socket for "+m_substance+" pump"); m_logger->error("Failed to create socket for "+m_substance+" pump");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment