Skip to content

Commit 0a1630f

Browse files
committed
updated the velocity check method
1 parent aaf450a commit 0a1630f

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

lbr_fri_ros2/include/lbr_fri_ros2/command_guard.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ class CommandGuard {
5454
protected:
5555
virtual bool command_in_position_limits_(const_idl_command_t_ref lbr_command,
5656
const_idl_state_t_ref /*lbr_state*/) const;
57-
virtual bool command_in_velocity_limits_(const_idl_command_t_ref lbr_command,
58-
const_idl_state_t_ref lbr_state);
57+
virtual bool command_in_velocity_limits_(const_idl_state_t_ref lbr_state);
5958
virtual bool command_in_torque_limits_(const_idl_command_t_ref lbr_command,
6059
const_idl_state_t_ref lbr_state) const;
6160

lbr_fri_ros2/src/command_guard.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ bool CommandGuard::is_valid_command(const_idl_command_t_ref lbr_command,
99
if (!command_in_position_limits_(lbr_command, lbr_state)) {
1010
return false;
1111
}
12-
if (!command_in_velocity_limits_(lbr_command, lbr_state)) {
12+
if (!command_in_velocity_limits_(lbr_state)) {
1313
return false;
1414
}
1515
return true;
@@ -42,15 +42,14 @@ bool CommandGuard::command_in_position_limits_(const_idl_command_t_ref lbr_comma
4242
return true;
4343
}
4444

45-
bool CommandGuard::command_in_velocity_limits_(const_idl_command_t_ref lbr_command,
46-
const_idl_state_t_ref lbr_state) {
45+
bool CommandGuard::command_in_velocity_limits_(const_idl_state_t_ref lbr_state) {
4746
const double &dt = lbr_state.sample_time;
4847
if (!prev_measured_joint_position_init_) {
4948
prev_measured_joint_position_init_ = true;
5049
prev_measured_joint_position_ = lbr_state.measured_joint_position;
5150
return true;
5251
}
53-
for (std::size_t i = 0; i < lbr_command.joint_position.size(); ++i) {
52+
for (std::size_t i = 0; i < lbr_state.measured_joint_position.size(); ++i) {
5453
if (std::abs(prev_measured_joint_position_[i] - lbr_state.measured_joint_position[i]) / dt >
5554
parameters_.max_velocities[i]) {
5655
RCLCPP_ERROR_STREAM(rclcpp::get_logger(LOGGER_NAME),

0 commit comments

Comments
 (0)