Skip to content

Commit ed7a782

Browse files
committed
Format with precommit
1 parent 39dafe9 commit ed7a782

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

steering_controllers_library/src/steering_controllers_library.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,9 @@ controller_interface::return_type SteeringControllersLibrary::update_reference_f
552552
// accept message only if there is no timeout
553553
if (age_of_last_command <= ref_timeout_ || ref_timeout_ == rclcpp::Duration::from_seconds(0))
554554
{
555-
if (!std::isnan(current_ref_twist_.twist.linear.x) && !std::isnan(current_ref_twist_.twist.angular.z))
555+
if (
556+
!std::isnan(current_ref_twist_.twist.linear.x) &&
557+
!std::isnan(current_ref_twist_.twist.angular.z))
556558
{
557559
reference_interfaces_[0] = current_ref_twist_.twist.linear.x;
558560
reference_interfaces_[1] = current_ref_twist_.twist.angular.z;
@@ -568,7 +570,9 @@ controller_interface::return_type SteeringControllersLibrary::update_reference_f
568570
}
569571
else
570572
{
571-
if (!std::isnan(current_ref_twist_.twist.linear.x) && !std::isnan(current_ref_twist_.twist.angular.z))
573+
if (
574+
!std::isnan(current_ref_twist_.twist.linear.x) &&
575+
!std::isnan(current_ref_twist_.twist.angular.z))
572576
{
573577
reference_interfaces_[0] = std::numeric_limits<double>::quiet_NaN();
574578
reference_interfaces_[1] = std::numeric_limits<double>::quiet_NaN();
@@ -593,7 +597,9 @@ controller_interface::return_type SteeringControllersLibrary::update_reference_f
593597
// accept message only if there is no timeout
594598
if (age_of_last_command <= ref_timeout_ || ref_timeout_ == rclcpp::Duration::from_seconds(0))
595599
{
596-
if (!std::isnan(current_ref_steering_.linear_velocity) && !std::isnan(current_ref_steering_.steering_angle))
600+
if (
601+
!std::isnan(current_ref_steering_.linear_velocity) &&
602+
!std::isnan(current_ref_steering_.steering_angle))
597603
{
598604
reference_interfaces_[0] = current_ref_steering_.linear_velocity;
599605
reference_interfaces_[1] = current_ref_steering_.steering_angle;
@@ -609,7 +615,9 @@ controller_interface::return_type SteeringControllersLibrary::update_reference_f
609615
}
610616
else
611617
{
612-
if (!std::isnan(current_ref_steering_.linear_velocity) && !std::isnan(current_ref_steering_.steering_angle))
618+
if (
619+
!std::isnan(current_ref_steering_.linear_velocity) &&
620+
!std::isnan(current_ref_steering_.steering_angle))
613621
{
614622
reference_interfaces_[0] = std::numeric_limits<double>::quiet_NaN();
615623
reference_interfaces_[1] = std::numeric_limits<double>::quiet_NaN();

steering_controllers_library/test/test_steering_controllers_library.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ TEST_F(SteeringControllersLibraryTest, test_position_feedback_ref_timeout)
149149
msg.twist.angular.z = TEST_ANGULAR_VELOCITY_Z;
150150
controller_->input_ref_twist_.set(msg);
151151

152-
age_of_last_command = controller_->get_node()->now() - controller_->input_ref_twist_.get().header.stamp;
152+
age_of_last_command =
153+
controller_->get_node()->now() - controller_->input_ref_twist_.get().header.stamp;
153154

154155
// age_of_last_command > ref_timeout_
155156
ASSERT_FALSE(age_of_last_command <= controller_->ref_timeout_);
@@ -244,7 +245,8 @@ TEST_F(SteeringControllersLibraryTest, test_velocity_feedback_ref_timeout)
244245
msg.twist.angular.z = TEST_ANGULAR_VELOCITY_Z;
245246
controller_->input_ref_twist_.set(msg);
246247

247-
age_of_last_command = controller_->get_node()->now() - controller_->input_ref_twist_.get().header.stamp;
248+
age_of_last_command =
249+
controller_->get_node()->now() - controller_->input_ref_twist_.get().header.stamp;
248250

249251
// age_of_last_command > ref_timeout_
250252
ASSERT_FALSE(age_of_last_command <= controller_->ref_timeout_);

steering_controllers_library/test/test_steering_controllers_library_steering_input.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ TEST_F(SteeringControllersLibrarySteeringInputTest, test_both_update_methods_for
112112
msg->linear_velocity = TEST_LINEAR_VELOCITY_X;
113113
msg->steering_angle = TEST_STEERING_ANGLE;
114114
controller_->input_ref_steering_.set(*msg);
115-
115+
116116
// Process the valid message
117117
ASSERT_EQ(
118118
controller_->update(controller_->get_node()->now(), rclcpp::Duration::from_seconds(0.01)),
@@ -126,16 +126,14 @@ TEST_F(SteeringControllersLibrarySteeringInputTest, test_both_update_methods_for
126126
controller_->input_ref_steering_.set(*msg);
127127

128128
const auto age_of_last_command =
129-
controller_->get_node()->now() -
130-
controller_->input_ref_steering_.get().header.stamp;
129+
controller_->get_node()->now() - controller_->input_ref_steering_.get().header.stamp;
131130

132131
// case 1 position_feedback = false
133132
controller_->params_.position_feedback = false;
134133

135134
// age_of_last_command > ref_timeout_
136135
ASSERT_FALSE(age_of_last_command <= controller_->ref_timeout_);
137-
ASSERT_EQ(
138-
controller_->input_ref_steering_.get().linear_velocity, TEST_LINEAR_VELOCITY_X);
136+
ASSERT_EQ(controller_->input_ref_steering_.get().linear_velocity, TEST_LINEAR_VELOCITY_X);
139137
ASSERT_EQ(
140138
controller_->update(controller_->get_node()->now(), rclcpp::Duration::from_seconds(0.01)),
141139
controller_interface::return_type::OK);
@@ -171,7 +169,7 @@ TEST_F(SteeringControllersLibrarySteeringInputTest, test_both_update_methods_for
171169
msg->linear_velocity = TEST_LINEAR_VELOCITY_X;
172170
msg->steering_angle = TEST_STEERING_ANGLE;
173171
controller_->input_ref_steering_.set(*msg);
174-
172+
175173
// Process the valid message
176174
ASSERT_EQ(
177175
controller_->update(controller_->get_node()->now(), rclcpp::Duration::from_seconds(0.01)),
@@ -186,8 +184,7 @@ TEST_F(SteeringControllersLibrarySteeringInputTest, test_both_update_methods_for
186184

187185
// age_of_last_command > ref_timeout_
188186
ASSERT_FALSE(age_of_last_command <= controller_->ref_timeout_);
189-
ASSERT_EQ(
190-
controller_->input_ref_steering_.get().linear_velocity, TEST_LINEAR_VELOCITY_X);
187+
ASSERT_EQ(controller_->input_ref_steering_.get().linear_velocity, TEST_LINEAR_VELOCITY_X);
191188
ASSERT_EQ(
192189
controller_->update(controller_->get_node()->now(), rclcpp::Duration::from_seconds(0.01)),
193190
controller_interface::return_type::OK);

0 commit comments

Comments
 (0)