mirror of
https://gitlab.com/obbart/universal_robots_ros_driver.git
synced 2026-04-10 18:10:47 +02:00
Added verification of RT message length for firmware versions 1.6 to 3.2
This commit is contained in:
@@ -60,7 +60,6 @@ RobotStateRT::~RobotStateRT() {
|
||||
pMsg_cond_->notify_all();
|
||||
}
|
||||
|
||||
|
||||
void RobotStateRT::setDataPublished() {
|
||||
data_published_ = false;
|
||||
}
|
||||
@@ -75,7 +74,6 @@ bool RobotStateRT::getControllerUpdated() {
|
||||
return controller_updated_;
|
||||
}
|
||||
|
||||
|
||||
double RobotStateRT::ntohd(uint64_t nf) {
|
||||
double x;
|
||||
nf = be64toh(nf);
|
||||
@@ -321,16 +319,28 @@ void RobotStateRT::unpack(uint8_t * buf) {
|
||||
|
||||
offset += sizeof(len);
|
||||
len = ntohl(len);
|
||||
if (version_ > 3. & version_ < 3.1 & len != 1044) {
|
||||
//In 3.0, every 4th? package is malformed...?
|
||||
//printf("Len: %i\n", len);
|
||||
val_lock_.unlock();
|
||||
return;
|
||||
|
||||
//Check the correct message length is received
|
||||
bool len_good = true;
|
||||
if (version_ >= 1.6 && version_ < 1.7) { //v1.6
|
||||
if (len != 756)
|
||||
len_good = false;
|
||||
} else if (version_ >= 1.7 && version_ < 1.8) { //v1.7
|
||||
if (len != 764)
|
||||
len_good = false;
|
||||
} else if (version_ >= 1.8 && version_ < 1.9) { //v1.8
|
||||
if (len != 812)
|
||||
len_good = false;
|
||||
} else if (version_ >= 3.0 && version_ < 3.2) { //v3.0 & v3.1
|
||||
if (len != 1044)
|
||||
len_good = false;
|
||||
} else if (version_ >= 3.2 && version_ < 3.3) { //v3.2
|
||||
if (len != 1060)
|
||||
len_good = false;
|
||||
}
|
||||
|
||||
if (version_ > 1.8 & version_ < 1.9 & len != 812) {
|
||||
// In 1.8.14035, every 17th and 18th package is 560 and 9 bytes long/malformed.
|
||||
//printf("Len: %i\n", len);
|
||||
if (!len_good) {
|
||||
printf("Wrong length of message on RT interface: %i\n", len);
|
||||
val_lock_.unlock();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ UrDriver::UrDriver(std::condition_variable& rt_msg_cond,
|
||||
struct sockaddr_in serv_addr;
|
||||
int n, flag;
|
||||
|
||||
firmware_version_ = 0;
|
||||
reverse_connected_ = false;
|
||||
executing_traj_ = false;
|
||||
rt_interface_ = new UrRealtimeCommunication(rt_msg_cond, host,
|
||||
|
||||
Reference in New Issue
Block a user