Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions steering_controllers_library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@ if(BUILD_TESTING)
ament_add_gmock(test_steering_odometry test/test_steering_odometry.cpp)
target_link_libraries(test_steering_odometry steering_controllers_library)

add_rostest_with_parameters_gmock(
test_steering_controllers_open_library test/test_steering_controllers_library.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test/steering_controllers_library_open_loop_timeout_params.yaml)
target_include_directories(test_steering_controllers_open_library PRIVATE include)
target_link_libraries(test_steering_controllers_open_library steering_controllers_library)
ament_target_dependencies(
test_steering_controllers_open_library
controller_interface
hardware_interface
)

ament_add_gmock(test_steering_odometry_open_loop_timeout test/test_steering_odometry.cpp)
target_link_libraries(test_steering_odometry_open_loop_timeout steering_controllers_library)

endif()

install(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
test_steering_controllers_library_open_loop_timeout:
ros__parameters:

reference_timeout: 0.1
front_steering: true
open_loop: true
velocity_rolling_window_size: 10
position_feedback: false
use_stamped_vel: true
rear_wheels_names: [rear_right_wheel_joint, rear_left_wheel_joint]
front_wheels_names: [front_right_steering_joint, front_left_steering_joint]

wheelbase: 3.24644
front_wheel_track: 2.12321
rear_wheel_track: 1.76868
front_wheels_radius: 0.45
rear_wheels_radius: 0.45
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,14 @@ class TestableSteeringControllersLibrary
return controller_interface::CallbackReturn::SUCCESS;
}

bool update_odometry(const rclcpp::Duration & /*period*/) { return true; }
bool update_odometry(const rclcpp::Duration & period)
{
if (params_.open_loop)
{
odometry_.update_open_loop(last_linear_velocity_, last_angular_velocity_, period.seconds());
}
return true;
}
};

// We are using template class here for easier reuse of Fixture in specializations of controllers
Expand Down
Loading