Skip to content

Commit 48a66cc

Browse files
committed
Integrated more feedback
1 parent dd64226 commit 48a66cc

File tree

5 files changed

+16
-21
lines changed

5 files changed

+16
-21
lines changed

steering_controllers_library/doc/userdoc.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,14 @@ Subscribers
8585

8686
Used when controller is not in chained mode (``in_chained_mode == false``) and the twist input mode is activated (``twist_input == true``):
8787
- ``<controller_name>/reference`` [`geometry_msgs/msg/TwistStamped <twist_msg_>`_]
88+
In this configuration the controller uses :
89+
- **Linear Velocity (`linear`)**: Represents the linear speed of the robot (in meters per second, m/s).
90+
- **Angular Velocity (`angular`)**: Represents the angular speed of the robot (in meters per second, m/s).
8891
When the controller is not in chained mode (``in_chained_mode == false``) and the twist input mode is not activated (``twist_input == false``):
8992
- ``<controller_name>/reference`` [`control_msgs/msg/SteeringControllerCommand <steering_controller_command_msg_>`_]
93+
In this configuration the controller uses :
94+
- **Linear Velocity (`speed`)**: Represents the linear velocity of the robot (in meters per second, m/s).
95+
- **Steering angle (`steering_angle`)**: Represents the angle of the imaginary, central steering wheel relative to the vehicle’s longitudinal axis. Specific angles for individual steering joints are computed internally based on the kinematic model of the robot. (in radians, rad)
9096

9197
Publishers
9298
,,,,,,,,,,,

steering_controllers_library/src/steering_controllers_library.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,6 @@ void reset_controller_reference_msg(
4444
msg.twist.angular.z = std::numeric_limits<double>::quiet_NaN();
4545
}
4646

47-
void reset_controller_reference_msg(
48-
const std::shared_ptr<ControllerSteeringReferenceMsg> & msg,
49-
const std::shared_ptr<rclcpp_lifecycle::LifecycleNode> & node)
50-
{
51-
msg->header.stamp = node->now();
52-
msg->linear_velocity = std::numeric_limits<double>::quiet_NaN();
53-
msg->steering_angle = std::numeric_limits<double>::quiet_NaN();
54-
}
55-
5647
void reset_controller_reference_msg(
5748
ControllerSteeringReferenceMsg & msg,
5849
const std::shared_ptr<rclcpp_lifecycle::LifecycleNode> & node)
@@ -647,10 +638,6 @@ controller_interface::return_type SteeringControllersLibrary::update_and_write_c
647638
const auto timeout =
648639
age_of_last_command > ref_timeout_ && ref_timeout_ != rclcpp::Duration::from_seconds(0);
649640

650-
// store (for open loop odometry) and set commands
651-
last_linear_velocity_ = timeout ? 0.0 : reference_interfaces_[0];
652-
last_angular_velocity_ = timeout ? 0.0 : reference_interfaces_[1];
653-
654641
auto [traction_commands, steering_commands] = odometry_.get_commands(
655642
reference_interfaces_[0], reference_interfaces_[1], params_.open_loop,
656643
params_.reduce_wheel_speed_until_steering_reached, params_.use_twist_input);

steering_controllers_library/src/steering_odometry.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,21 +182,24 @@ bool SteeringOdometry::update_from_velocity(
182182

183183
double linear_velocity = get_linear_velocity_double_traction_axle(
184184
right_traction_wheel_vel, left_traction_wheel_vel, steer_pos_);
185-
const double angular_velocity = std::tan(steer_pos_) * linear_velocity / wheel_base_;
185+
const double angular_velocity =
186+
convert_steering_angle_to_angular_velocity(linear_velocity, steer_pos_);
186187

187188
return update_odometry(linear_velocity, angular_velocity, dt);
188189
}
189190

190191
void SteeringOdometry::update_open_loop(
191-
const double v_bx, const double omega_bz, const double dt, const bool use_twist_input)
192+
const double v_bx, const double last_angular_command_, const double dt,
193+
const bool use_twist_input)
192194
{
193195
/// Save last linear and angular velocity:
194196
linear_ = v_bx;
195-
angular_ =
196-
use_twist_input ? omega_bz : convert_steering_angle_to_angular_velocity(v_bx, omega_bz);
197+
angular_ = use_twist_input
198+
? last_angular_command_
199+
: convert_steering_angle_to_angular_velocity(v_bx, last_angular_command_);
197200

198201
/// Integrate odometry:
199-
integrate_fk(v_bx, omega_bz, dt);
202+
integrate_fk(v_bx, last_angular_command_, dt);
200203
}
201204

202205
void SteeringOdometry::set_wheel_params(double wheel_radius, double wheel_base, double wheel_track)

steering_controllers_library/test/test_steering_controllers_library_steering_input.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2023, Stogl Robotics Consulting UG (haftungsbeschränkt)
1+
// Copyright (c) 2023, FaSTTUBe - Formula Student Team TU Berlin
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

steering_controllers_library/test/test_steering_controllers_library_steering_input.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2023, Stogl Robotics Consulting UG (haftungsbeschränkt)
1+
// Copyright (c) 2025, FaSTTUBe - Formula Student Team TU Berlin
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -331,7 +331,6 @@ class SteeringControllersSteeringInputLibraryFixture : public ::testing::Test
331331
std::string steering_interface_name_ = "position";
332332
// defined in setup
333333
std::string traction_interface_name_ = "";
334-
std::string preceeding_prefix_ = "pid_controller";
335334

336335
std::vector<hardware_interface::StateInterface> state_itfs_;
337336
std::vector<hardware_interface::CommandInterface> command_itfs_;

0 commit comments

Comments
 (0)