mirror of
https://gitlab.com/obbart/universal_robots_ros_driver.git
synced 2026-04-10 10:00:48 +02:00
Added boundary check for setting payload
This commit is contained in:
@@ -12,8 +12,10 @@
|
||||
#include "ur_modern_driver/ur_driver.h"
|
||||
|
||||
UrDriver::UrDriver(std::condition_variable& msg_cond, std::string host,
|
||||
unsigned int safety_count_max, double max_time_step, double max_vel, double min_payload, double max_payload ) :
|
||||
maximum_time_step_(max_time_step), maximum_velocity_(max_vel), minimum_payload_(min_payload), maximum_payload_(max_payload) {
|
||||
unsigned int safety_count_max, double max_time_step, double max_vel,
|
||||
double min_payload, double max_payload) :
|
||||
maximum_time_step_(max_time_step), maximum_velocity_(max_vel), minimum_payload_(
|
||||
min_payload), maximum_payload_(max_payload) {
|
||||
rt_interface_ = new UrRealtimeCommunication(msg_cond, host,
|
||||
safety_count_max);
|
||||
|
||||
@@ -142,12 +144,15 @@ void UrDriver::setAnalogOut(unsigned int n, double f) {
|
||||
rt_interface_->addCommandToQueue(buf);
|
||||
}
|
||||
|
||||
void UrDriver::setPayload(double m) {
|
||||
char buf[256];
|
||||
sprintf(buf, "sec setOut():\n\tset_payload(%1.3f)\nend\n", m);
|
||||
printf("%s", buf);
|
||||
rt_interface_->addCommandToQueue(buf);
|
||||
|
||||
bool UrDriver::setPayload(double m) {
|
||||
if ((m < maximum_payload_) && (m > minimum_payload_)) {
|
||||
char buf[256];
|
||||
sprintf(buf, "sec setOut():\n\tset_payload(%1.3f)\nend\n", m);
|
||||
printf("%s", buf);
|
||||
rt_interface_->addCommandToQueue(buf);
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
void UrDriver::setMaxVel(double vel) {
|
||||
|
||||
Reference in New Issue
Block a user