Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion ur_controllers/src/passthrough_trajectory_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,21 @@
active_joint_traj_ = active_goal->gh_->get_goal()->trajectory;

if (current_index_ == 0 && current_transfer_state == TRANSFER_STATE_IDLE) {
size_t traj_size = active_joint_traj_.points.size();

Check warning on line 268 in ur_controllers/src/passthrough_trajectory_controller.cpp

View check run for this annotation

Codecov / codecov/patch

ur_controllers/src/passthrough_trajectory_controller.cpp#L268

Added line #L268 was not covered by tests
if (active_joint_traj_.points[0].time_from_start.sec == 0 &&
active_joint_traj_.points[0].time_from_start.nanosec == 0) {
RCLCPP_WARN(get_node()->get_logger(),

Check warning on line 271 in ur_controllers/src/passthrough_trajectory_controller.cpp

View check run for this annotation

Codecov / codecov/patch

ur_controllers/src/passthrough_trajectory_controller.cpp#L270-L271

Added lines #L270 - L271 were not covered by tests
"First point of trajectory has time_from_start set to 0. This is not recommended, as it may lead "
"to unexpected behavior. Removing the first point");
current_index_++;
traj_size--;

Check warning on line 275 in ur_controllers/src/passthrough_trajectory_controller.cpp

View check run for this annotation

Codecov / codecov/patch

ur_controllers/src/passthrough_trajectory_controller.cpp#L274-L275

Added lines #L274 - L275 were not covered by tests
}
active_trajectory_elapsed_time_ = rclcpp::Duration(0, 0);
max_trajectory_time_ =
rclcpp::Duration::from_seconds(duration_to_double(active_joint_traj_.points.back().time_from_start));
write_success &= transfer_command_interface_->get().set_value(TRANSFER_STATE_NEW_TRAJECTORY);
write_success &=
trajectory_size_command_interface_->get().set_value(static_cast<double>(active_joint_traj_.points.size()));
trajectory_size_command_interface_->get().set_value(static_cast<double>(traj_size));

Check warning on line 282 in ur_controllers/src/passthrough_trajectory_controller.cpp

View check run for this annotation

Codecov / codecov/patch

ur_controllers/src/passthrough_trajectory_controller.cpp#L282

Added line #L282 was not covered by tests
}
auto active_goal_time_tol = goal_time_tolerance_.readFromRT();
auto joint_mapping = joint_trajectory_mapping_.readFromRT();
Expand Down Expand Up @@ -547,6 +556,17 @@
<< goal_handle->get_goal()->trajectory.points.size() << " points.");
current_index_ = 0;

for (auto& point : goal_handle->get_goal()->trajectory.points) {
std::stringstream ss;
ss << "time_from_start: " << point.time_from_start.sec << "." << point.time_from_start.nanosec
<< " sec, positions: " << std::setprecision(3) << std::fixed << "[";

Check warning on line 562 in ur_controllers/src/passthrough_trajectory_controller.cpp

View check run for this annotation

Codecov / codecov/patch

ur_controllers/src/passthrough_trajectory_controller.cpp#L560-L562

Added lines #L560 - L562 were not covered by tests
for (const auto& pos : point.positions) {
ss << std::setw(8) << pos << ", ";

Check warning on line 564 in ur_controllers/src/passthrough_trajectory_controller.cpp

View check run for this annotation

Codecov / codecov/patch

ur_controllers/src/passthrough_trajectory_controller.cpp#L564

Added line #L564 was not covered by tests
}
ss << "]";
RCLCPP_INFO_STREAM(get_node()->get_logger(), ss.str());

Check warning on line 567 in ur_controllers/src/passthrough_trajectory_controller.cpp

View check run for this annotation

Codecov / codecov/patch

ur_controllers/src/passthrough_trajectory_controller.cpp#L566-L567

Added lines #L566 - L567 were not covered by tests
}

// TODO(fexner): Merge goal tolerances with default tolerances

joint_trajectory_mapping_.writeFromNonRT(create_joint_mapping(goal_handle->get_goal()->trajectory.joint_names));
Expand Down
4 changes: 3 additions & 1 deletion ur_moveit_config/config/moveit_controllers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ trajectory_execution:
moveit_simple_controller_manager:
controller_names:
- scaled_joint_trajectory_controller
- passthrough_trajectory_controller
- joint_trajectory_controller

scaled_joint_trajectory_controller:
#scaled_joint_trajectory_controller:
passthrough_trajectory_controller:
action_ns: follow_joint_trajectory
type: FollowJointTrajectory
default: true
Expand Down
2 changes: 1 addition & 1 deletion ur_robot_driver/launch/ur_control.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def generate_launch_description():
declared_arguments.append(
DeclareLaunchArgument(
"initial_joint_controller",
default_value="scaled_joint_trajectory_controller",
default_value="passthrough_trajectory_controller",
choices=[
"scaled_joint_trajectory_controller",
"joint_trajectory_controller",
Expand Down
Loading