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:
@@ -40,6 +40,7 @@ private:
|
|||||||
int incoming_sockfd_;
|
int incoming_sockfd_;
|
||||||
int new_sockfd_;
|
int new_sockfd_;
|
||||||
double servoj_time_;
|
double servoj_time_;
|
||||||
|
bool executing_traj_;
|
||||||
public:
|
public:
|
||||||
UrRealtimeCommunication* rt_interface_;
|
UrRealtimeCommunication* rt_interface_;
|
||||||
UrCommunication* sec_interface_;
|
UrCommunication* sec_interface_;
|
||||||
|
|||||||
@@ -126,13 +126,14 @@ void UrDriver::doTraj(std::vector<double> inp_timestamps,
|
|||||||
std::vector<double> positions;
|
std::vector<double> positions;
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
|
|
||||||
|
executing_traj_ = true;
|
||||||
UrDriver::uploadProg();
|
UrDriver::uploadProg();
|
||||||
|
|
||||||
t0 = std::chrono::high_resolution_clock::now();
|
t0 = std::chrono::high_resolution_clock::now();
|
||||||
t = t0;
|
t = t0;
|
||||||
j = 0;
|
j = 0;
|
||||||
while (inp_timestamps[inp_timestamps.size() - 1]
|
while ((inp_timestamps[inp_timestamps.size() - 1]
|
||||||
>= std::chrono::duration_cast<std::chrono::duration<double>>(t - t0).count()) {
|
>= std::chrono::duration_cast<std::chrono::duration<double>>(t - t0).count()) and executing_traj_) {
|
||||||
while (inp_timestamps[j]
|
while (inp_timestamps[j]
|
||||||
<= std::chrono::duration_cast<std::chrono::duration<double>>(
|
<= std::chrono::duration_cast<std::chrono::duration<double>>(
|
||||||
t - t0).count() && j < inp_timestamps.size() - 1) {
|
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();
|
t = std::chrono::high_resolution_clock::now();
|
||||||
}
|
}
|
||||||
//Signal robot to stop driverProg()
|
//Signal robot to stop driverProg()
|
||||||
|
executing_traj_ = false;
|
||||||
UrDriver::closeServo(positions);
|
UrDriver::closeServo(positions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,6 +185,7 @@ void UrDriver::servoj(std::vector<double> positions,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void UrDriver::stopTraj() {
|
void UrDriver::stopTraj() {
|
||||||
|
executing_traj_ = false;
|
||||||
rt_interface_->addCommandToQueue("stopj(10)\n");
|
rt_interface_->addCommandToQueue("stopj(10)\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user