1
0
mirror of https://gitlab.com/obbart/universal_robots_ros_driver.git synced 2026-04-10 01:50:46 +02:00

Added a check to see that the robot is connected before attempting to write to the socket. Fixes #11

This commit is contained in:
Thomas Timm Andersen
2015-10-28 11:25:59 +01:00
parent b0a896b2e7
commit 839d90c4ab

View File

@@ -89,7 +89,10 @@ void UrRealtimeCommunication::addCommandToQueue(std::string inp) {
if (inp.back() != '\n') { if (inp.back() != '\n') {
inp.append("\n"); inp.append("\n");
} }
bytes_written = write(sockfd_, inp.c_str(), inp.length()); if (connected_)
bytes_written = write(sockfd_, inp.c_str(), inp.length());
else
print_error("Could not send command \"" +inp + "\". The robot is not connected! Command is discarded" );
} }
void UrRealtimeCommunication::setSpeed(double q0, double q1, double q2, void UrRealtimeCommunication::setSpeed(double q0, double q1, double q2,