Skip to content

Commit 1ecd8d5

Browse files
committed
Revert "SJTC: Correctly handle an unset update rate (#1886)"
This reverts commit 383c18a.
1 parent 383c18a commit 1ecd8d5

4 files changed

Lines changed: 3 additions & 25 deletions

File tree

ur_bringup/config/ur_controllers.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ joint_trajectory_controller:
8686
$(var tf_prefix)wrist_1_joint: { trajectory: 0.2, goal: 0.1 }
8787
$(var tf_prefix)wrist_2_joint: { trajectory: 0.2, goal: 0.1 }
8888
$(var tf_prefix)wrist_3_joint: { trajectory: 0.2, goal: 0.1 }
89-
update_rate: $(var update_rate)
9089

9190

9291
scaled_joint_trajectory_controller:

ur_controllers/src/scaled_joint_trajectory_controller.cpp

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,7 @@ controller_interface::InterfaceConfiguration ScaledJointTrajectoryController::st
7474

7575
controller_interface::CallbackReturn ScaledJointTrajectoryController::on_configure(const rclcpp_lifecycle::State& state)
7676
{
77-
auto update_rate = get_update_rate();
78-
79-
if (update_rate == 0) {
80-
RCLCPP_WARN(get_node()->get_logger(), "Controller's update_rate is 0. Please configure a non-zero update_rate for "
81-
"the controller to work properly. Falling back to sampling trajectory at "
82-
"current_time + last period.");
83-
update_period_ = rclcpp::Duration(0, 0);
84-
} else {
85-
update_period_ = rclcpp::Duration(0, static_cast<uint32_t>(1.0e9 / static_cast<double>(get_update_rate())));
86-
}
77+
update_period_ = rclcpp::Duration(0.0, static_cast<uint32_t>(1.0e9 / static_cast<double>(get_update_rate())));
8778

8879
return JointTrajectoryController::on_configure(state);
8980
}
@@ -194,10 +185,8 @@ controller_interface::return_type ScaledJointTrajectoryController::update(const
194185
end_segment_itr);
195186
state_desired_.time_from_start = traj_time_ - traj_external_point_ptr_->time_from_start();
196187

197-
// find segment for current timestamp. Look controller period ahead, fallback to last cycle's
198-
// period if no update rate is configured.
199-
const auto& sample_period = update_period_.seconds() == 0.0 ? period : update_period_;
200-
const bool valid_point = traj_external_point_ptr_->sample(traj_time_ + sample_period, interpolation_method_,
188+
// find segment for current timestamp
189+
const bool valid_point = traj_external_point_ptr_->sample(traj_time_ + update_period_, interpolation_method_,
201190
command_next_, start_segment_itr, end_segment_itr);
202191
state_current_.time_from_start = time - traj_external_point_ptr_->time_from_start();
203192

ur_robot_driver/config/ur_controllers.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ scaled_joint_trajectory_controller:
133133
$(var tf_prefix)wrist_2_joint: { trajectory: 0.2, goal: 0.1 }
134134
$(var tf_prefix)wrist_3_joint: { trajectory: 0.2, goal: 0.1 }
135135
speed_scaling_interface_name: $(var tf_prefix)speed_scaling/speed_scaling_factor
136-
update_rate: $(var update_rate)
137136

138137
passthrough_trajectory_controller:
139138
ros__parameters:

ur_robot_driver/launch/ur_control.launch.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
#
3030
# Author: Denis Stogl
3131

32-
import yaml
33-
3432
from launch_ros.actions import Node
3533
from launch_ros.parameter_descriptions import ParameterFile, ParameterValue
3634
from launch_ros.substitutions import FindPackagePrefix, FindPackageShare
@@ -230,13 +228,6 @@ def launch_setup(context, *args, **kwargs):
230228
]
231229
)
232230

233-
# Expose the controller_manager update_rate as a launch configuration so
234-
# that '$(var update_rate)' substitutions inside controller config yaml
235-
# resolve to the correct rate for this ur_type.
236-
with open(update_rate_config_file.perform(context)) as f:
237-
update_rate = yaml.safe_load(f)["controller_manager"]["ros__parameters"]["update_rate"]
238-
context.launch_configurations["update_rate"] = str(update_rate)
239-
240231
control_node = Node(
241232
package="controller_manager",
242233
executable="ros2_control_node",

0 commit comments

Comments
 (0)