Skip to content

Commit 934ccc5

Browse files
author
Felix Exner
committed
Make sure the abort state is reset when sending new trajectories
1 parent bc76a61 commit 934ccc5

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

ur_controllers/src/passthrough_trajectory_controller.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ controller_interface::return_type PassthroughTrajectoryController::update(const
190190
if (current_transfer_state != TRANSFER_STATE_IDLE) {
191191
// Check if the trajectory has been aborted from the hardware interface. E.g. the robot was stopped on the teach
192192
// pendant.
193-
if (command_interfaces_[PASSTHROUGH_TRAJECTORY_ABORT].get_value() == 1.0) {
193+
if (command_interfaces_[PASSTHROUGH_TRAJECTORY_ABORT].get_value() == 1.0 && current_index_ > 0) {
194194
RCLCPP_INFO(get_node()->get_logger(), "Trajectory aborted hardware, aborting action.");
195195
std::shared_ptr<control_msgs::action::FollowJointTrajectory::Result> result =
196196
std::make_shared<control_msgs::action::FollowJointTrajectory::Result>();
@@ -278,7 +278,8 @@ controller_interface::return_type PassthroughTrajectoryController::update(const
278278
result->error_code = control_msgs::action::FollowJointTrajectory::Result::SUCCESSFUL;
279279
active_goal->setSucceeded(result);
280280
end_goal();
281-
RCLCPP_INFO(get_node()->get_logger(), "Trajectory executed successfully!");
281+
RCLCPP_INFO(get_node()->get_logger(), "Trajectory executed successfully in %f seconds!",
282+
active_trajectory_elapsed_time_.seconds());
282283
}
283284
} else if (current_transfer_state == TRANSFER_STATE_IN_MOTION) {
284285
// Keep track of how long the trajectory has been executing, if it takes too long, send a warning.

ur_robot_driver/src/hardware_interface.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,7 @@ hardware_interface::return_type URPositionHardwareInterface::perform_command_mod
933933
velocity_controller_running_ = false;
934934
position_controller_running_ = false;
935935
passthrough_trajectory_controller_running_ = true;
936+
passthrough_trajectory_abort_ = 0.0;
936937
}
937938

938939
start_modes_.clear();
@@ -947,6 +948,7 @@ void URPositionHardwareInterface::check_passthrough_trajectory_controller()
947948
/* See passthrough_trajectory_controller.hpp for an explanation of the passthrough_trajectory_transfer_state_ values.
948949
*/
949950
if (passthrough_trajectory_transfer_state_ == 2.0) {
951+
passthrough_trajectory_abort_ = 0.0;
950952
trajectory_joint_positions_.push_back(passthrough_trajectory_positions_);
951953

952954
trajectory_times_.push_back(passthrough_trajectory_time_from_start_ - last_time);

0 commit comments

Comments
 (0)