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

code cleanup

This commit is contained in:
Thomas Timm Andersen
2015-10-20 13:24:52 +02:00
parent f856487e9f
commit 1de174d73f
2 changed files with 9 additions and 11 deletions

View File

@@ -70,7 +70,7 @@ public:
bool doTraj(std::vector<double> inp_timestamps, bool doTraj(std::vector<double> inp_timestamps,
std::vector<std::vector<double> > inp_positions, std::vector<std::vector<double> > inp_positions,
std::vector<std::vector<double> > inp_velocities); std::vector<std::vector<double> > inp_velocities);
void servoj(std::vector<double> positions, int keepalive = 1, double time = 0); void servoj(std::vector<double> positions, int keepalive = 1);
void stopTraj(); void stopTraj();

View File

@@ -168,18 +168,16 @@ bool UrDriver::doTraj(std::vector<double> inp_timestamps,
return true; return true;
} }
void UrDriver::servoj(std::vector<double> positions, int keepalive, void UrDriver::servoj(std::vector<double> positions, int keepalive) {
double time) {
if (!reverse_connected_) { if (!reverse_connected_) {
print_error("UrDriver::servoj called without a reverse connection present. Keepalive: " + std::to_string(keepalive)); print_error(
"UrDriver::servoj called without a reverse connection present. Keepalive: "
+ std::to_string(keepalive));
return; return;
} }
unsigned int bytes_written; unsigned int bytes_written;
int tmp; int tmp;
unsigned char buf[28]; unsigned char buf[28];
if (time < 0.016) {
time = servoj_time_;
}
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
tmp = htonl((int) (positions[i] * MULT_JOINTSTATE_)); tmp = htonl((int) (positions[i] * MULT_JOINTSTATE_));
buf[i * 4] = tmp & 0xff; buf[i * 4] = tmp & 0xff;
@@ -303,10 +301,10 @@ bool UrDriver::start() {
sec_interface_->robot_state_->getVersion()); sec_interface_->robot_state_->getVersion());
if (!rt_interface_->start()) if (!rt_interface_->start())
return false; return false;
ip_addr_ = rt_interface_->getLocalIp(); //inet_ntoa(serv_addr.sin_addr); ip_addr_ = rt_interface_->getLocalIp();
char buf[256]; print_debug(
sprintf(buf, "Listening on %s:%u\n", ip_addr_.c_str(), REVERSE_PORT_); "Listening on " + ip_addr_ + ":" + std::to_string(REVERSE_PORT_)
print_debug(buf); + "\n");
return true; return true;
} }