Skip to content

Segmentation fault when 2 ODrives are connected #47

Description

@ScheglyakStas

I am getting a segmentation fault when trying to start a ros2_control_node in ROS2 Jazzy with two ODrive modules connected.
I was using the Factor-Robotics repository, with the humble-fw-0.5.1 branch selected (since I had 0.5.1 firmware on my ODrives).

Initially I assumed that the error was caused by incompatibility with ROS2 Jazzy, so I've migrated to racarla96's fork (jazzy-fw-0.5.6 branch) and upgraded my ODrives to 0.5.6. However, I'm still getting the segmentation fault.

The ODrive modules are successfully detected and controlled by odrivetool.
I'm running ROS2 Jazzy on Ubuntu 24.04, installed on an Orange Pi 5 Pro.

Disconnecting one of the modules and removing it from ros2_control fixes the issue. If both ODrives are connected, the error persists regardless of how many are present in ros2_control.
But I need to be able to control both ODrives.

Here is my ros2_control section (originally it contained two ODrives, but I've removed one for debugging purposes).

    <ros2_control name="DriveHardware" type="system">
        <hardware>
            <plugin>odrive_hardware_interface/ODriveHardwareInterface</plugin>
        </hardware>
        <joint name="front_left_wheel_joint">
            <param name="serial_number">3564345D3034</param>
            <param name="axis">1</param>
            <param name="enable_watchdog">1</param>
            <param name="watchdog_timeout">0.1</param>
        </joint>
        <joint name="rear_left_wheel_joint">
            <param name="serial_number">3564345D3034</param>
            <param name="axis">0</param>
            <param name="enable_watchdog">1</param>
            <param name="watchdog_timeout">0.1</param>
        </joint>
    </ros2_control>

Here's the full error log:

[ros2_control_node-2] Stack trace (most recent call last):
[ros2_control_node-2] #20   Object "/usr/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1", at 0xffffffffffffffff, in
[ros2_control_node-2] #19   Object "/opt/ros/jazzy/lib/controller_manager/ros2_control_node", at 0xaaaabe50582f, in _start
[ros2_control_node-2] #18   Object "/usr/lib/aarch64-linux-gnu/libc.so.6", at 0xffffb15d8597, in __libc_start_main
[ros2_control_node-2] #17   Object "/usr/lib/aarch64-linux-gnu/libc.so.6", at 0xffffb15d84c3, in
[ros2_control_node-2] #16   Object "/opt/ros/jazzy/lib/controller_manager/ros2_control_node", at 0xaaaabe504ce3, in main
[ros2_control_node-2] #15   Object "/opt/ros/jazzy/lib/librclcpp.so", at 0xffffb1b82c3b, in rclcpp::executors::MultiThreadedExecutor::spin()
[ros2_control_node-2] #14   Object "/opt/ros/jazzy/lib/librclcpp.so", at 0xffffb1b828c3, in rclcpp::executors::MultiThreadedExecutor::run(unsigned long)
[ros2_control_node-2] #13   Object "/opt/ros/jazzy/lib/librclcpp.so", at 0xffffb1b6c9b3, in rclcpp::Executor::execute_any_executable(rclcpp::AnyExecutable&)
[ros2_control_node-2] #12   Object "/opt/ros/jazzy/lib/librclcpp.so", at 0xffffb1b6bc37, in rclcpp::Executor::execute_subscription(std::shared_ptr<rclcpp::SubscriptionBase>)
[ros2_control_node-2] #11   Object "/opt/ros/jazzy/lib/libcontroller_manager.so", at 0xffffb1e5fab7, in
[ros2_control_node-2] #10   Object "/opt/ros/jazzy/lib/libcontroller_manager.so", at 0xffffb1dd1c5b, in controller_manager::ControllerManager::robot_description_callback(std_msgs::msg::String_<std::allocator<void> > const&)
[ros2_control_node-2] #9    Object "/opt/ros/jazzy/lib/libcontroller_manager.so", at 0xffffb1dcfe4f, in controller_manager::ControllerManager::init_resource_manager(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
[ros2_control_node-2] #8    Object "/opt/ros/jazzy/lib/libhardware_interface.so", at 0xffffb13ca8db, in hardware_interface::ResourceManager::load_and_initialize_components(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int)
[ros2_control_node-2] #7    Object "/opt/ros/jazzy/lib/libhardware_interface.so", at 0xffffb13d97df, in
[ros2_control_node-2] #6    Object "/opt/ros/jazzy/lib/libhardware_interface.so", at 0xffffb13f40df, in hardware_interface::HardwareComponent::initialize(hardware_interface::HardwareComponentParams const&)
[ros2_control_node-2] #5    Object "/opt/ros/jazzy/lib/libhardware_interface.so", at 0xffffb14014a3, in hardware_interface::HardwareComponentInterface::init(hardware_interface::HardwareComponentParams const&)
[ros2_control_node-2] #4    Object "/home/ubuntu/roborace_ws/build/odrive_hardware_interface/libodrive_hardware_interface.so", at 0xffff8064d573, in odrive_hardware_interface::ODriveHardwareInterface::on_init(hardware_interface::HardwareInfo const&)
[ros2_control_node-2] #3    Object "/home/ubuntu/roborace_ws/build/odrive_hardware_interface/libodrive_usb.so", at 0xffff805dc157, in int odrive::ODriveUSB::read<float>(long&, short, float&)
[ros2_control_node-2] #2    Object "/home/ubuntu/roborace_ws/build/odrive_hardware_interface/libodrive_usb.so", at 0xffff805ded17, in int odrive::ODriveUSB::read<float>(libusb_device_handle*, short, float&)
[ros2_control_node-2] #1    Object "/home/ubuntu/roborace_ws/build/odrive_hardware_interface/libodrive_usb.so", at 0xffff805db8f7, in odrive::ODriveUSB::endpointOperation(libusb_device_handle*, short, short, std::vector<unsigned char, std::allocator<unsigned char> >, std::vector<unsigned char, std::allocator<unsigned char> >&, bool)
[ros2_control_node-2] #0    Object "/usr/lib/aarch64-linux-gnu/libusb-1.0.so.0.4.0", at 0xffff805a0788, in
[ros2_control_node-2] Segmentation fault (Address not mapped to object [0x174])

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions