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

Stop sending data to servoj when stopTraj is called

This commit is contained in:
Thomas Timm Andersen
2015-10-08 15:47:39 +02:00
parent 8c9595bbf2
commit 1d54bcca1d
2 changed files with 6 additions and 2 deletions

View File

@@ -126,13 +126,14 @@ void UrDriver::doTraj(std::vector<double> inp_timestamps,
std::vector<double> positions;
unsigned int j;
executing_traj_ = true;
UrDriver::uploadProg();
t0 = std::chrono::high_resolution_clock::now();
t = t0;
j = 0;
while (inp_timestamps[inp_timestamps.size() - 1]
>= std::chrono::duration_cast<std::chrono::duration<double>>(t - t0).count()) {
while ((inp_timestamps[inp_timestamps.size() - 1]
>= std::chrono::duration_cast<std::chrono::duration<double>>(t - t0).count()) and executing_traj_) {
while (inp_timestamps[j]
<= std::chrono::duration_cast<std::chrono::duration<double>>(
t - t0).count() && j < inp_timestamps.size() - 1) {
@@ -151,6 +152,7 @@ void UrDriver::doTraj(std::vector<double> inp_timestamps,
t = std::chrono::high_resolution_clock::now();
}
//Signal robot to stop driverProg()
executing_traj_ = false;
UrDriver::closeServo(positions);
}
@@ -183,6 +185,7 @@ void UrDriver::servoj(std::vector<double> positions,
}
void UrDriver::stopTraj() {
executing_traj_ = false;
rt_interface_->addCommandToQueue("stopj(10)\n");
}