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

Fixed a bug related to malformed RT messages in 3.0.

updated readme
This commit is contained in:
Thomas Timm Andersen
2015-09-16 16:14:51 +02:00
parent 61dac1e977
commit 834136a997
4 changed files with 38 additions and 14 deletions

View File

@@ -299,20 +299,16 @@ void RobotStateRT::unpack(uint8_t * buf) {
uint64_t unpack_to;
uint16_t offset = 0;
val_lock_.lock();
if (version_ == 0.0) {
uint32_t len;
memcpy(&len, &buf[offset], sizeof(len));
if (len <= 756) {
version_ = 1.6;
} else if (len <= 764) {
version_ = 1.7;
} else if (len <= 812) {
version_ = 1.8;
} else if (len <= 1044) {
version_ = 3.0;
}
int len;
memcpy(&len, &buf[offset], sizeof(len));
offset += sizeof(len);
len = ntohl(len);
if (len > 1500) {
//In 3.0, every 3rd? package is malformed...?
val_lock_.unlock();
return;
}
offset += 4;
memcpy(&unpack_to, &buf[offset], sizeof(unpack_to));
time_ = RobotStateRT::ntohd(unpack_to);
offset += sizeof(double);

View File

@@ -98,7 +98,7 @@ void UrCommunication::start() {
//wait for some traffic so the UR socket doesn't die in version 3.1.
std::this_thread::sleep_for(std::chrono::milliseconds(500));
#ifdef ROS_BUILD
ROS_DEBUG("Firmware version detected: %f", robot_state_->getVersion());
ROS_INFO("Firmware version detected: %f", robot_state_->getVersion());
#else
printf("Firmware version detected: %f\n", robot_state_->getVersion());
#endif