Skip to content

Commit c83dce3

Browse files
committed
Remove front_steering from steering library
To Accommodate controllers that are not only steering at front or rear this change remove the `front_steering` variable from steering_controller_library, as a byproduct of that the the notino of front or rear wheel radius is also removed from dependant controllers and the library has know "wheels" and "steers" joints. Signed-off-by: Quique Llorente <ellorent@redhat.com>
1 parent b245155 commit c83dce3

27 files changed

+210
-389
lines changed

ackermann_steering_controller/src/ackermann_steering_controller.cpp

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,11 @@ controller_interface::CallbackReturn AckermannSteeringController::configure_odom
3131
{
3232
ackermann_params_ = ackermann_param_listener_->get_params();
3333

34-
const double front_wheels_radius = ackermann_params_.front_wheels_radius;
35-
const double rear_wheels_radius = ackermann_params_.rear_wheels_radius;
36-
const double front_wheel_track = ackermann_params_.front_wheel_track;
37-
const double rear_wheel_track = ackermann_params_.rear_wheel_track;
34+
const double traction_wheels_radius = ackermann_params_.traction_wheels_radius;
35+
const double traction_wheel_track = ackermann_params_.traction_wheel_track;
3836
const double wheelbase = ackermann_params_.wheelbase;
3937

40-
if (params_.front_steering)
41-
{
42-
odometry_.set_wheel_params(rear_wheels_radius, wheelbase, rear_wheel_track);
43-
}
44-
else
45-
{
46-
odometry_.set_wheel_params(front_wheels_radius, wheelbase, front_wheel_track);
47-
}
48-
38+
odometry_.set_wheel_params(traction_wheels_radius, wheelbase, traction_wheel_track);
4939
odometry_.set_odometry_type(steering_odometry::ACKERMANN_CONFIG);
5040

5141
set_interface_numbers(NR_STATE_ITFS, NR_CMD_ITFS, NR_REF_ITFS);

ackermann_steering_controller/src/ackermann_steering_controller.yaml

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
11
ackermann_steering_controller:
2-
front_wheel_track:
2+
traction_wheel_track:
33
{
44
type: double,
55
default_value: 0.0,
6-
description: "Front wheel track length. For details see: https://en.wikipedia.org/wiki/Wheelbase",
7-
read_only: false,
8-
validation: {
9-
gt<>: [0.0]
10-
}
11-
}
12-
13-
rear_wheel_track:
14-
{
15-
type: double,
16-
default_value: 0.0,
17-
description: "Rear wheel track length. For details see: https://en.wikipedia.org/wiki/Wheelbase",
6+
description: "Traction wheel track length. For details see: https://en.wikipedia.org/wiki/Wheelbase",
187
read_only: false,
198
validation: {
209
gt<>: [0.0]
@@ -32,22 +21,11 @@ ackermann_steering_controller:
3221
}
3322
}
3423

35-
front_wheels_radius:
36-
{
37-
type: double,
38-
default_value: 0.0,
39-
description: "Front wheels radius.",
40-
read_only: false,
41-
validation: {
42-
gt<>: [0.0]
43-
}
44-
}
45-
46-
rear_wheels_radius:
24+
traction_wheels_radius:
4725
{
4826
type: double,
4927
default_value: 0.0,
50-
description: "Rear wheels radius.",
28+
description: "Traction wheels radius.",
5129
read_only: false,
5230
validation: {
5331
gt<>: [0.0]

ackermann_steering_controller/test/ackermann_steering_controller_params.yaml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@ test_ackermann_steering_controller:
22
ros__parameters:
33

44
reference_timeout: 2.0
5-
front_steering: true
65
open_loop: false
76
velocity_rolling_window_size: 10
87
position_feedback: false
9-
rear_wheels_names: [rear_right_wheel_joint, rear_left_wheel_joint]
10-
front_wheels_names: [front_right_steering_joint, front_left_steering_joint]
8+
wheels_names: [rear_right_wheel_joint, rear_left_wheel_joint]
9+
steers_names: [front_right_steering_joint, front_left_steering_joint]
1110

1211
wheelbase: 3.24644
13-
front_wheel_track: 2.12321
14-
rear_wheel_track: 1.76868
15-
front_wheels_radius: 0.45
16-
rear_wheels_radius: 0.45
12+
traction_wheel_track: 1.76868
13+
traction_wheels_radius: 0.45
Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
test_ackermann_steering_controller:
22
ros__parameters:
33
reference_timeout: 2.0
4-
front_steering: true
54
open_loop: false
65
velocity_rolling_window_size: 10
76
position_feedback: false
8-
rear_wheels_names: [pid_controller/rear_right_wheel_joint, pid_controller/rear_left_wheel_joint]
9-
front_wheels_names: [pid_controller/front_right_steering_joint, pid_controller/front_left_steering_joint]
10-
rear_wheels_state_names: [rear_right_wheel_joint, rear_left_wheel_joint]
11-
front_wheels_state_names: [front_right_steering_joint, front_left_steering_joint]
7+
wheels_names: [pid_controller/rear_right_wheel_joint, pid_controller/rear_left_wheel_joint]
8+
steers_names: [pid_controller/front_right_steering_joint, pid_controller/front_left_steering_joint]
9+
wheels_state_names: [rear_right_wheel_joint, rear_left_wheel_joint]
10+
steers_state_names: [front_right_steering_joint, front_left_steering_joint]
1211
wheelbase: 3.24644
13-
front_wheel_track: 2.12321
14-
rear_wheel_track: 1.76868
15-
front_wheels_radius: 0.45
16-
rear_wheels_radius: 0.45
12+
traction_wheel_track: 1.76868
13+
traction_wheels_radius: 0.45

ackermann_steering_controller/test/test_ackermann_steering_controller.cpp

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,15 @@ TEST_F(AckermannSteeringControllerTest, all_parameters_set_configure_success)
3232
ASSERT_EQ(controller_->on_configure(rclcpp_lifecycle::State()), NODE_SUCCESS);
3333

3434
ASSERT_THAT(
35-
controller_->params_.rear_wheels_names, testing::ElementsAreArray(rear_wheels_names_));
35+
controller_->params_.wheels_names, testing::ElementsAreArray(wheels_names_));
3636
ASSERT_THAT(
37-
controller_->params_.front_wheels_names, testing::ElementsAreArray(front_wheels_names_));
38-
ASSERT_EQ(controller_->params_.front_steering, front_steering_);
37+
controller_->params_.steers_names, testing::ElementsAreArray(steers_names_));
3938
ASSERT_EQ(controller_->params_.open_loop, open_loop_);
4039
ASSERT_EQ(controller_->params_.velocity_rolling_window_size, velocity_rolling_window_size_);
4140
ASSERT_EQ(controller_->params_.position_feedback, position_feedback_);
4241
ASSERT_EQ(controller_->ackermann_params_.wheelbase, wheelbase_);
43-
ASSERT_EQ(controller_->ackermann_params_.front_wheels_radius, front_wheels_radius_);
44-
ASSERT_EQ(controller_->ackermann_params_.rear_wheels_radius, rear_wheels_radius_);
45-
ASSERT_EQ(controller_->ackermann_params_.front_wheel_track, front_wheel_track_);
46-
ASSERT_EQ(controller_->ackermann_params_.rear_wheel_track, rear_wheel_track_);
42+
ASSERT_EQ(controller_->ackermann_params_.traction_wheels_radius, traction_wheels_radius_);
43+
ASSERT_EQ(controller_->ackermann_params_.traction_wheel_track, traction_wheel_track_);
4744
}
4845

4946
TEST_F(AckermannSteeringControllerTest, check_exported_interfaces)
@@ -56,32 +53,32 @@ TEST_F(AckermannSteeringControllerTest, check_exported_interfaces)
5653
ASSERT_EQ(cmd_if_conf.names.size(), joint_command_values_.size());
5754
EXPECT_EQ(
5855
cmd_if_conf.names[CMD_TRACTION_RIGHT_WHEEL],
59-
rear_wheels_names_[0] + "/" + traction_interface_name_);
56+
wheels_names_[0] + "/" + traction_interface_name_);
6057
EXPECT_EQ(
6158
cmd_if_conf.names[CMD_TRACTION_LEFT_WHEEL],
62-
rear_wheels_names_[1] + "/" + traction_interface_name_);
59+
wheels_names_[1] + "/" + traction_interface_name_);
6360
EXPECT_EQ(
6461
cmd_if_conf.names[CMD_STEER_RIGHT_WHEEL],
65-
front_wheels_names_[0] + "/" + steering_interface_name_);
62+
steers_names_[0] + "/" + steering_interface_name_);
6663
EXPECT_EQ(
6764
cmd_if_conf.names[CMD_STEER_LEFT_WHEEL],
68-
front_wheels_names_[1] + "/" + steering_interface_name_);
65+
steers_names_[1] + "/" + steering_interface_name_);
6966
EXPECT_EQ(cmd_if_conf.type, controller_interface::interface_configuration_type::INDIVIDUAL);
7067

7168
auto state_if_conf = controller_->state_interface_configuration();
7269
ASSERT_EQ(state_if_conf.names.size(), joint_state_values_.size());
7370
EXPECT_EQ(
7471
state_if_conf.names[STATE_TRACTION_RIGHT_WHEEL],
75-
controller_->rear_wheels_state_names_[0] + "/" + traction_interface_name_);
72+
controller_->wheels_state_names_[0] + "/" + traction_interface_name_);
7673
EXPECT_EQ(
7774
state_if_conf.names[STATE_TRACTION_LEFT_WHEEL],
78-
controller_->rear_wheels_state_names_[1] + "/" + traction_interface_name_);
75+
controller_->wheels_state_names_[1] + "/" + traction_interface_name_);
7976
EXPECT_EQ(
8077
state_if_conf.names[STATE_STEER_RIGHT_WHEEL],
81-
controller_->front_wheels_state_names_[0] + "/" + steering_interface_name_);
78+
controller_->steers_state_names_[0] + "/" + steering_interface_name_);
8279
EXPECT_EQ(
8380
state_if_conf.names[STATE_STEER_LEFT_WHEEL],
84-
controller_->front_wheels_state_names_[1] + "/" + steering_interface_name_);
81+
controller_->steers_state_names_[1] + "/" + steering_interface_name_);
8582
EXPECT_EQ(state_if_conf.type, controller_interface::interface_configuration_type::INDIVIDUAL);
8683

8784
// check ref itfsTIME

ackermann_steering_controller/test/test_ackermann_steering_controller.hpp

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -165,22 +165,22 @@ class AckermannSteeringControllerFixture : public ::testing::Test
165165
command_ifs.reserve(joint_command_values_.size());
166166

167167
command_itfs_.emplace_back(hardware_interface::CommandInterface(
168-
rear_wheels_names_[0], traction_interface_name_,
168+
wheels_names_[0], traction_interface_name_,
169169
&joint_command_values_[CMD_TRACTION_RIGHT_WHEEL]));
170170
command_ifs.emplace_back(command_itfs_.back());
171171

172172
command_itfs_.emplace_back(hardware_interface::CommandInterface(
173-
rear_wheels_names_[1], steering_interface_name_,
173+
wheels_names_[1], steering_interface_name_,
174174
&joint_command_values_[CMD_TRACTION_LEFT_WHEEL]));
175175
command_ifs.emplace_back(command_itfs_.back());
176176

177177
command_itfs_.emplace_back(hardware_interface::CommandInterface(
178-
front_wheels_names_[0], steering_interface_name_,
178+
steers_names_[0], steering_interface_name_,
179179
&joint_command_values_[CMD_STEER_RIGHT_WHEEL]));
180180
command_ifs.emplace_back(command_itfs_.back());
181181

182182
command_itfs_.emplace_back(hardware_interface::CommandInterface(
183-
front_wheels_names_[1], steering_interface_name_,
183+
steers_names_[1], steering_interface_name_,
184184
&joint_command_values_[CMD_STEER_LEFT_WHEEL]));
185185
command_ifs.emplace_back(command_itfs_.back());
186186

@@ -189,22 +189,22 @@ class AckermannSteeringControllerFixture : public ::testing::Test
189189
state_ifs.reserve(joint_state_values_.size());
190190

191191
state_itfs_.emplace_back(hardware_interface::StateInterface(
192-
rear_wheels_names_[0], traction_interface_name_,
192+
wheels_names_[0], traction_interface_name_,
193193
&joint_state_values_[STATE_TRACTION_RIGHT_WHEEL]));
194194
state_ifs.emplace_back(state_itfs_.back());
195195

196196
state_itfs_.emplace_back(hardware_interface::StateInterface(
197-
rear_wheels_names_[1], traction_interface_name_,
197+
wheels_names_[1], traction_interface_name_,
198198
&joint_state_values_[STATE_TRACTION_LEFT_WHEEL]));
199199
state_ifs.emplace_back(state_itfs_.back());
200200

201201
state_itfs_.emplace_back(hardware_interface::StateInterface(
202-
front_wheels_names_[0], steering_interface_name_,
202+
steers_names_[0], steering_interface_name_,
203203
&joint_state_values_[STATE_STEER_RIGHT_WHEEL]));
204204
state_ifs.emplace_back(state_itfs_.back());
205205

206206
state_itfs_.emplace_back(hardware_interface::StateInterface(
207-
front_wheels_names_[1], steering_interface_name_,
207+
steers_names_[1], steering_interface_name_,
208208
&joint_state_values_[STATE_STEER_LEFT_WHEEL]));
209209
state_ifs.emplace_back(state_itfs_.back());
210210

@@ -276,29 +276,26 @@ class AckermannSteeringControllerFixture : public ::testing::Test
276276
protected:
277277
// Controller-related parameters
278278
double reference_timeout_ = 2.0;
279-
bool front_steering_ = true;
280279
bool open_loop_ = false;
281280
unsigned int velocity_rolling_window_size_ = 10;
282281
bool position_feedback_ = false;
283-
std::vector<std::string> rear_wheels_names_ = {"rear_right_wheel_joint", "rear_left_wheel_joint"};
284-
std::vector<std::string> front_wheels_names_ = {
282+
std::vector<std::string> wheels_names_ = {"rear_right_wheel_joint", "rear_left_wheel_joint"};
283+
std::vector<std::string> steers_names_ = {
285284
"front_right_steering_joint", "front_left_steering_joint"};
286285
std::vector<std::string> joint_names_ = {
287-
rear_wheels_names_[0], rear_wheels_names_[1], front_wheels_names_[0], front_wheels_names_[1]};
286+
wheels_names_[0], wheels_names_[1], steers_names_[0], steers_names_[1]};
288287

289-
std::vector<std::string> rear_wheels_preceeding_names_ = {
288+
std::vector<std::string> wheels_preceeding_names_ = {
290289
"pid_controller/rear_right_wheel_joint", "pid_controller/rear_left_wheel_joint"};
291-
std::vector<std::string> front_wheels_preceeding_names_ = {
290+
std::vector<std::string> steers_preceeding_names_ = {
292291
"pid_controller/front_right_steering_joint", "pid_controller/front_left_steering_joint"};
293292
std::vector<std::string> preceeding_joint_names_ = {
294-
rear_wheels_preceeding_names_[0], rear_wheels_preceeding_names_[1],
295-
front_wheels_preceeding_names_[0], front_wheels_preceeding_names_[1]};
293+
wheels_preceeding_names_[0], wheels_preceeding_names_[1],
294+
steers_preceeding_names_[0], steers_preceeding_names_[1]};
296295

297296
double wheelbase_ = 3.24644;
298-
double front_wheel_track_ = 2.12321;
299-
double rear_wheel_track_ = 1.76868;
300-
double front_wheels_radius_ = 0.45;
301-
double rear_wheels_radius_ = 0.45;
297+
double traction_wheel_track_ = 1.76868;
298+
double traction_wheels_radius_ = 0.45;
302299

303300
std::array<double, 4> joint_state_values_ = {0.5, 0.5, 0.0, 0.0};
304301
std::array<double, 4> joint_command_values_ = {1.1, 3.3, 2.2, 4.4};

ackermann_steering_controller/test/test_ackermann_steering_controller_preceeding.cpp

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,17 @@ TEST_F(AckermannSteeringControllerTest, all_parameters_set_configure_success)
3232
ASSERT_EQ(controller_->on_configure(rclcpp_lifecycle::State()), NODE_SUCCESS);
3333

3434
ASSERT_THAT(
35-
controller_->params_.rear_wheels_names,
36-
testing::ElementsAreArray(rear_wheels_preceeding_names_));
35+
controller_->params_.wheels_names,
36+
testing::ElementsAreArray(wheels_preceeding_names_));
3737
ASSERT_THAT(
38-
controller_->params_.front_wheels_names,
39-
testing::ElementsAreArray(front_wheels_preceeding_names_));
40-
ASSERT_EQ(controller_->params_.front_steering, front_steering_);
38+
controller_->params_.steers_names,
39+
testing::ElementsAreArray(steers_preceeding_names_));
4140
ASSERT_EQ(controller_->params_.open_loop, open_loop_);
4241
ASSERT_EQ(controller_->params_.velocity_rolling_window_size, velocity_rolling_window_size_);
4342
ASSERT_EQ(controller_->params_.position_feedback, position_feedback_);
4443
ASSERT_EQ(controller_->ackermann_params_.wheelbase, wheelbase_);
45-
ASSERT_EQ(controller_->ackermann_params_.front_wheels_radius, front_wheels_radius_);
46-
ASSERT_EQ(controller_->ackermann_params_.rear_wheels_radius, rear_wheels_radius_);
47-
ASSERT_EQ(controller_->ackermann_params_.front_wheel_track, front_wheel_track_);
48-
ASSERT_EQ(controller_->ackermann_params_.rear_wheel_track, rear_wheel_track_);
44+
ASSERT_EQ(controller_->ackermann_params_.traction_wheels_radius, traction_wheels_radius_);
45+
ASSERT_EQ(controller_->ackermann_params_.traction_wheel_track, traction_wheel_track_);
4946
}
5047

5148
TEST_F(AckermannSteeringControllerTest, check_exported_interfaces)
@@ -58,32 +55,32 @@ TEST_F(AckermannSteeringControllerTest, check_exported_interfaces)
5855
ASSERT_EQ(cmd_if_conf.names.size(), joint_command_values_.size());
5956
EXPECT_EQ(
6057
cmd_if_conf.names[CMD_TRACTION_RIGHT_WHEEL],
61-
preceeding_prefix_ + "/" + rear_wheels_names_[0] + "/" + traction_interface_name_);
58+
preceeding_prefix_ + "/" + wheels_names_[0] + "/" + traction_interface_name_);
6259
EXPECT_EQ(
6360
cmd_if_conf.names[CMD_TRACTION_LEFT_WHEEL],
64-
preceeding_prefix_ + "/" + rear_wheels_names_[1] + "/" + traction_interface_name_);
61+
preceeding_prefix_ + "/" + wheels_names_[1] + "/" + traction_interface_name_);
6562
EXPECT_EQ(
6663
cmd_if_conf.names[CMD_STEER_RIGHT_WHEEL],
67-
preceeding_prefix_ + "/" + front_wheels_names_[0] + "/" + steering_interface_name_);
64+
preceeding_prefix_ + "/" + steers_names_[0] + "/" + steering_interface_name_);
6865
EXPECT_EQ(
6966
cmd_if_conf.names[CMD_STEER_LEFT_WHEEL],
70-
preceeding_prefix_ + "/" + front_wheels_names_[1] + "/" + steering_interface_name_);
67+
preceeding_prefix_ + "/" + steers_names_[1] + "/" + steering_interface_name_);
7168
EXPECT_EQ(cmd_if_conf.type, controller_interface::interface_configuration_type::INDIVIDUAL);
7269

7370
auto state_if_conf = controller_->state_interface_configuration();
7471
ASSERT_EQ(state_if_conf.names.size(), joint_state_values_.size());
7572
EXPECT_EQ(
7673
state_if_conf.names[STATE_TRACTION_RIGHT_WHEEL],
77-
controller_->rear_wheels_state_names_[0] + "/" + traction_interface_name_);
74+
controller_->wheels_state_names_[0] + "/" + traction_interface_name_);
7875
EXPECT_EQ(
7976
state_if_conf.names[STATE_TRACTION_LEFT_WHEEL],
80-
controller_->rear_wheels_state_names_[1] + "/" + traction_interface_name_);
77+
controller_->wheels_state_names_[1] + "/" + traction_interface_name_);
8178
EXPECT_EQ(
8279
state_if_conf.names[STATE_STEER_RIGHT_WHEEL],
83-
controller_->front_wheels_state_names_[0] + "/" + steering_interface_name_);
80+
controller_->steers_state_names_[0] + "/" + steering_interface_name_);
8481
EXPECT_EQ(
8582
state_if_conf.names[STATE_STEER_LEFT_WHEEL],
86-
controller_->front_wheels_state_names_[1] + "/" + steering_interface_name_);
83+
controller_->steers_state_names_[1] + "/" + steering_interface_name_);
8784
EXPECT_EQ(state_if_conf.type, controller_interface::interface_configuration_type::INDIVIDUAL);
8885

8986
// check ref itfs

bicycle_steering_controller/src/bicycle_steering_controller.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,9 @@ controller_interface::CallbackReturn BicycleSteeringController::configure_odomet
3232
bicycle_params_ = bicycle_param_listener_->get_params();
3333

3434
const double wheelbase = bicycle_params_.wheelbase;
35-
const double front_wheel_radius = bicycle_params_.front_wheel_radius;
36-
const double rear_wheel_radius = bicycle_params_.rear_wheel_radius;
37-
38-
if (params_.front_steering)
39-
{
40-
odometry_.set_wheel_params(rear_wheel_radius, wheelbase);
41-
}
42-
else
43-
{
44-
odometry_.set_wheel_params(front_wheel_radius, wheelbase);
45-
}
35+
const double traction_wheel_radius = bicycle_params_.traction_wheel_radius;
4636

37+
odometry_.set_wheel_params(traction_wheel_radius, wheelbase);
4738
odometry_.set_odometry_type(steering_odometry::BICYCLE_CONFIG);
4839

4940
set_interface_numbers(NR_STATE_ITFS, NR_CMD_ITFS, NR_REF_ITFS);

bicycle_steering_controller/src/bicycle_steering_controller.yaml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,11 @@ bicycle_steering_controller:
1010
}
1111
}
1212

13-
front_wheel_radius:
13+
traction_wheel_radius:
1414
{
1515
type: double,
1616
default_value: 0.0,
17-
description: "Front wheel radius.",
18-
read_only: false,
19-
validation: {
20-
gt<>: [0.0]
21-
}
22-
}
23-
24-
rear_wheel_radius:
25-
{
26-
type: double,
27-
default_value: 0.0,
28-
description: "Rear wheel radius.",
17+
description: "Steering wheel radius.",
2918
read_only: false,
3019
validation: {
3120
gt<>: [0.0]

0 commit comments

Comments
 (0)