Made basic interfacing with odrive

This commit is contained in:
2024-10-18 00:18:52 +02:00
parent a5106aaaba
commit 7019f3db16
4 changed files with 48 additions and 5 deletions

View File

@ -7,9 +7,45 @@ endif()
# find dependencies
find_package(ament_cmake REQUIRED)
# uncomment the following section in order to fill in
# further dependencies manually.
# find_package(<dependency> REQUIRED)
find_package(rclcpp REQUIRED)
find_package(pluginlib REQUIRED)
find_package(hardware_interface REQUIRED)
find_package(rclcpp_lifecycle REQUIRED)
find_package(rclcpp_components REQUIRED)
include(FindPkgConfig)
pkg_search_module(LIBSERIAL REQUIRED libserial)
add_library(
mg_wheel_interface
SHARED
src/mg_wheel_interface.cpp
)
target_include_directories(
mg_wheel_interface
PRIVATE
${LIBSERIAL_INCLUDE_DIRS}
include
)
target_link_libraries(
mg_wheel_interface
${LIBSERIAL_LIBRARIES}
)
ament_target_dependencies(
mg_wheel_interface
rclcpp
pluginlib
hardware_interface
rclcpp_lifecycle
)
pluginlib_export_plugin_description_file(hardware_interface mg_wheel_interface.xml)
install(
TARGETS mg_wheel_interface
DESTINATION lib
)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)

View File

@ -57,8 +57,7 @@
<ros2_control name="mg-base" type="system">
<hardware>
<plugin>mock_components/GenericSystem</plugin>
<param name="calculate_dynamics">true</param>
<plugin>mg_wheel_interface/MgOdriveInterface</plugin>
</hardware>
<joint name="left_motor">
<command_interface name="velocity"/>

View File

@ -16,5 +16,7 @@ diffdrive_controller:
odom_frame_id: odom
base_frame_id: base-link
open_loop: true
wheel_separation: 0.5
wheel_radius: 0.1

View File

@ -9,6 +9,9 @@
<buildtool_depend>ament_cmake</buildtool_depend>
<depend>rclcpp</depend>
<depend>rclcpp_lifecycle</depend>
<depend>rclcpp_components</depend>
<depend>pluginlib </depend>
<depend>hardware_interface</depend>
<depend>ros2launch</depend>
@ -19,6 +22,9 @@
<depend>joint_state_broadcaster</depend>
<depend>rsl</depend>
<build_depend>libserial-dev</build_depend>
<exec_depend>libserial</exec_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>