factor-robotics / odrive_ros2_control Goto Github PK
View Code? Open in Web Editor NEWODrive driver for ros2_control
License: Apache License 2.0
ODrive driver for ros2_control
License: Apache License 2.0
Hi,
Thanks for sharing this great project.
I tried to implement the sharing package with my own robot. It can be run without issue.
However, when I issued zero /joint0_velocity_controller/commands, the wheel would stop but the it is freely to rotate if I rotate it manually. Is this behavior expected? Could I make the wheel not moving or hold when zero /joint0_velocity_controller/commands is sent? Otherwise the robot would drift for a distance before it really stops.
Hope you could enlighten me.
Thanks.
Hello.
I tried the odrive_demo_bringup with velocity control and it worked very well. Then I changed in the launch file to joint0_effort_controller, compile the package and it worked fine as well.
Now, I am not conscious of changing anything when I execute "ros2 launch odrive_demo_bringup odrive_multi_interface.launch.py" looks that the motor doesn´t make any little noise as before.
Hey, I have two hoverboard motors and an ODrive. I calibrated the two brushless motors as mentioned in the ODrive documentation. Now, I want to use these motors in ROS. I'm using the ODrive with the odrive_ros2_control package. However, I'm facing an issue where I can only control the velocity of axis0 (joint0). After 5 seconds of loading the controller, joint1 of axis1 goes out of closed-loop control and i cant set the velocity to this joint1
Can you suggest where the problem might be? I have used the same diffbot odrive_ros2_control. If you have any questions, please leave a comment and I will provide more information."
When I try to use this repo to control the odrive motor, when I run the launch file, it will automatically enter in close loop control. However, the close loop control is different with directly setting the odrive to close loop control in terminal. The close loop control of this repo allows the motor to be rotated and will not turn back automatically. While the terminal close loop control does not allow the rotation of motor and have a huge resistance force. I am wondering why? How can I get the mode in terminal set with this repo?
如果想同时使用odrive, 看到说明文档是使用serial number 设置,请问是在哪里设置? 或者哪里有相关资料呢,感谢!
I'm using the foxy-fw-v0.5.1 and running diffbot launch file
Not sure why I'm getting this error.
launch.substitutions.substitution_failure.SubstitutionFailure: executed command failed. Command: /opt/ros/foxy/bin/xacro /home/olufemi/awonet_ws/install/odrive_demo_description/share/odrive_demo_description/urdf/odrive_diffbot.urdf.xacro
I measured the communication time and found that an RW operation for a single axis takes about 5ms, which is super inefficient. It can only support one odrive with 2 axises running at 100hz.
May be use asynchronous API of libusb can speed up the communication and make it possible for multiple odrive running at high frequency
Has anyone had success getting this to run on an ODrive S1? Looks like the firmware is incompatible.
Hello,
My motor's CPR (count per revolution) is set to 4000. However, when I send position command 4000, it rotates more than 7 revolutions. What is the unit of the data I am sending through the topic, joint0_position_controller/commands
?
Thank you
Hello,
I was able to launch the odrive_bringup, but I see this error message when I publish the velocity command.
It's kind of weird because my motor is moving when publishing a really high number as my velocity, but the velocity is not constant. It's kind of jerking. It repeats rotating fast and slow. I wonder if this is because of the error message or because my control gains are wrong.
Does anybody know how to resolve this issue?
When I kill the odrive_ros2_control node while the motor speeds are not zero, the motors nicely stop because of the watchdog. But the next time I start the process again, the motors begin to spin at the last set speed during startup until a new speed command is received (which is not great for safety).
I'm guessing that at startup the library starts to feed the watchdog so last used speed is restored before zero speed is set again?
Could you set the requested speed to zero before starting the watchdog?
When starting odrive.launch.py
, a 'RuntimeError: Could not contact service /controller_manager/list_controllers' is encounterd. Using the debugger it seems that the USB communication is the problem: the second libusb_bulk_transfer (ODRIVE_IN_ENDPOINT) hangs. Any suggestions?
using the odrivetool
utility usb communication works as expected
THIS IS my controller.yaml file
controller_manager:
ros__parameters:
update_rate: 100 # Hz
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster
joint0_position_controller:
type: position_controllers/JointGroupPositionController
joint0_velocity_controller:
type: velocity_controllers/JointGroupVelocityController
joint0_effort_controller:
type: effort_controllers/JointGroupEffortController
joint1_position_controller:
type: position_controllers/JointGroupPositionController
joint1_velocity_controller:
type: velocity_controllers/JointGroupVelocityController
joint1_effort_controller:
type: effort_controllers/JointGroupEffortController
group_position_controller:
type: position_controllers/JointGroupPositionController
group_velocity_controller:
type: velocity_controllers/JointGroupVelocityController
group_effort_controller:
type: effort_controllers/JointGroupEffortController
joint0_position_controller:
ros__parameters:
joints:
- joint0
joint0_velocity_controller:
ros__parameters:
joints:
- joint0
joint0_effort_controller:
ros__parameters:
joints:
- joint0
joint1_position_controller:
ros__parameters:
joints:
- joint1
joint1_velocity_controller:
ros__parameters:
joints:
- joint1
joint1_effort_controller:
ros__parameters:
joints:
- joint1
group_position_controller:
ros__parameters:
joints:
- joint0
- joint1
group_velocity_controller:
ros__parameters:
joints:
- joint0
- joint1
group_effort_controller:
ros__parameters:
joints:
- joint0
- joint1
This is my launch file
# Copyright 2021 Factor Robotics
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.conditions import IfCondition
from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare
def generate_launch_description():
declared_arguments = []
declared_arguments.append(
DeclareLaunchArgument(
"enable_joint0",
default_value="true",
)
)
declared_arguments.append(
DeclareLaunchArgument(
"enable_joint1",
default_value="true",
)
)
declared_arguments.append(
DeclareLaunchArgument(
"joint0_controller",
default_value="joint0_position_controller",
)
)
declared_arguments.append(
DeclareLaunchArgument(
"joint1_controller",
default_value="joint1_position_controller",
)
)
enable_joint0 = LaunchConfiguration("enable_joint0")
enable_joint1 = LaunchConfiguration("enable_joint1")
joint0_controller = LaunchConfiguration("joint0_controller")
joint1_controller = LaunchConfiguration("joint1_controller")
robot_description_content = Command(
[
PathJoinSubstitution([FindExecutable(name="xacro")]),
" ",
PathJoinSubstitution(
[
FindPackageShare("odrive_description"),
"urdf",
"odrive.urdf.xacro",
]
),
" ",
"enable_joint0:=",
enable_joint0,
" ",
"enable_joint1:=",
enable_joint1,
]
)
robot_description = {"robot_description": robot_description_content}
robot_controllers = PathJoinSubstitution(
[
FindPackageShare("odrive_bringup"),
"config",
"odrive_controllers.yaml",
]
)
control_node = Node(
package="controller_manager",
executable="ros2_control_node",
parameters=[robot_description, robot_controllers],
output={
"stdout": "screen",
"stderr": "screen",
},
)
robot_state_pub_node = Node(
package="robot_state_publisher",
executable="robot_state_publisher",
output="both",
parameters=[robot_description],
)
joint_state_broadcaster_spawner = Node(
package="controller_manager",
executable="spawner.py",
arguments=["joint_state_broadcaster", "--controller-manager", "/controller_manager"],
)
joint0_controller_spawner = Node(
package="controller_manager",
executable="spawner.py",
arguments=[joint0_controller, "-c", "/controller_manager"],
condition=IfCondition(enable_joint0),
)
joint1_controller_spawner = Node(
package="controller_manager",
executable="spawner.py",
arguments=[joint1_controller, "-c", "/controller_manager"],
condition=IfCondition(enable_joint1),
)
nodes = [
control_node,
robot_state_pub_node,
joint_state_broadcaster_spawner,
joint0_controller_spawner,
joint1_controller_spawner,
]
return LaunchDescription(declared_arguments + nodes)
[ERROR] [ros2_control_node-1]: process has died [pid 28410, exit code -6, cmd '/opt/ros/foxy/lib/controller_manager/ros2_control_node --ros-args --params-file /tmp/launch_params_0nfwf8mm --params-file /home/khadas/workspace/install/odrive_bringup/share/odrive_bringup/config/odrive_controllers.yaml'].
Could any one tell me the reason why it fails?
I see that in the documentation it says that it is possible to read the voltage sensor, but I have not been able to find information on how to do it in the documentation and if it is possible to put it in some topic to ros, does anyone know if it is possible to do it and if they have an example or guide to do it? Thanks
你好大神,请问下 odrive_hardware_interface/odrive_endpoints.hpp 这个文件是如何生成的? 我发现humble0.5.3版本这个文件里的enum值与我编译odrive0.5.3版本生成的endpoint.hpp里的值不一致,导致与odrive通讯出现问题跑不通。例如odrive_endpoints.hpp 里定义的AXIS_CONTROLLER__INTPUT_VEL = 253, 但是endpoint.hpp里253是get_input_torque,252才是get_input_vel。
odrive0.5.3版本发布有说明:
Changed
Removed odrivetool generate-code. This feature was broken in 0.5.2. Use interface_generator.py instead (see Tupfile.lua for examples).
但是我参考Tupfile.lua的样例还是没生成正确的odrive_endpoints.hpp。希望得到您的帮助,谢谢!
Get an error saying that "package 'diffbot_description' not found.
is there any plan for odrive pro?
I have probably missed something but the problem i have is with a diff drive robot using ros2 control under ros2 foxy. rviz shows wheels rotating correctly but when going forward both motors rotate in the same direction which means one wheel is going in the wrong direction due to motors bing mirrored.
I'm getting some weird errors while launching, errors mention "Could not contact service /controller_manager/list_controllers".
➜ ros2_ws ros2 launch odrive_bringup odrive.launch.py
[INFO] [launch]: All log files can be found below /home/richard/.ros/log/2021-09-15-15-08-53-286219-richard-GL65-9SEK-10069
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [ros2_control_node-1]: process started with pid [10073]
[INFO] [robot_state_publisher-2]: process started with pid [10075]
[INFO] [spawner.py-3]: process started with pid [10077]
[INFO] [spawner.py-4]: process started with pid [10079]
[robot_state_publisher-2] Parsing robot urdf xml string.
[robot_state_publisher-2] Link link0 had 0 children
[robot_state_publisher-2] [INFO] [1631711333.470852643] [robot_state_publisher]: got segment link0
[robot_state_publisher-2] [INFO] [1631711333.470911564] [robot_state_publisher]: got segment world
[spawner.py-3] Traceback (most recent call last):
[spawner.py-3] File "/opt/ros/foxy/lib/controller_manager/spawner.py", line 186, in <module>
[spawner.py-3] sys.exit(main())
[spawner.py-3] File "/opt/ros/foxy/lib/controller_manager/spawner.py", line 109, in main
[spawner.py-3] if is_controller_loaded(node, controller_manager_name, controller_name):
[spawner.py-3] File "/opt/ros/foxy/lib/controller_manager/spawner.py", line 51, in is_controller_loaded
[spawner.py-3] controllers = list_controllers(node, controller_manager).controller
[spawner.py-3] File "/opt/ros/foxy/lib/python3.8/site-packages/controller_manager/controller_manager_services.py", line 49, in list_controllers
[spawner.py-3] return service_caller(node, f'{controller_manager_name}/list_controllers',
[spawner.py-3] File "/opt/ros/foxy/lib/python3.8/site-packages/controller_manager/controller_manager_services.py", line 29, in service_caller
[spawner.py-3] raise RuntimeError(f'Could not contact service {service_name}')
[spawner.py-3] RuntimeError: Could not contact service /controller_manager/list_controllers
[spawner.py-4] Traceback (most recent call last):
[spawner.py-4] File "/opt/ros/foxy/lib/controller_manager/spawner.py", line 186, in <module>
[spawner.py-4] sys.exit(main())
[spawner.py-4] File "/opt/ros/foxy/lib/controller_manager/spawner.py", line 109, in main
[spawner.py-4] if is_controller_loaded(node, controller_manager_name, controller_name):
[spawner.py-4] File "/opt/ros/foxy/lib/controller_manager/spawner.py", line 51, in is_controller_loaded
[spawner.py-4] controllers = list_controllers(node, controller_manager).controller
[spawner.py-4] File "/opt/ros/foxy/lib/python3.8/site-packages/controller_manager/controller_manager_services.py", line 49, in list_controllers
[spawner.py-4] return service_caller(node, f'{controller_manager_name}/list_controllers',
[spawner.py-4] File "/opt/ros/foxy/lib/python3.8/site-packages/controller_manager/controller_manager_services.py", line 29, in service_caller
[spawner.py-4] raise RuntimeError(f'Could not contact service {service_name}')
[spawner.py-4] RuntimeError: Could not contact service /controller_manager/list_controllers
[ERROR] [spawner.py-4]: process has died [pid 10079, exit code 1, cmd '/opt/ros/foxy/lib/controller_manager/spawner.py joint0_velocity_controller -c /controller_manager --ros-args'].
[ERROR] [spawner.py-3]: process has died [pid 10077, exit code 1, cmd '/opt/ros/foxy/lib/controller_manager/spawner.py joint_state_broadcaster --controller-manager /controller_manager --ros-args'].
Looking at discussions about this error I found a discussion talking about the stability of the spawn.py of the controller_manager
ros-controls/ros2_control#475
They mention it could be because it's running on a slower PC but I'm running the same code on raspberry pi and my laptop PC with powerful specs that shouldn't be a problem and yet both platforms yield the same result.
I've also tried the fix that they proposed by incrementing the wait time but it just won't work. Any idea?
Hello,
I was wondering if your package works with ros2 humble, ODrive Firmware v0.5.4 and hoverboard motors?
If so, is it necessary to configure the odrive as indicated in the official documentation before running your hardware interface?
Also, it would be great if you could explain how to adapt this great hardware interface to our robot-specific urdf etc...
thanks in advance,
sacha
Hey, seems to be a nice library, trying to use it to control a differential drive robot but not entirely sure how to use it.
Managed to compile it and launch it with
os2 launch odrive_bringup odrive.launch.py enable_joint1:=true
Also managed to subscribe to the joint states topic.
ros2 topic echo /dynamic_joint_states
How would I go about controlling the motor velocities etc? Some documentation about using the library and some examples would help the package :)
CMake Error at CMakeLists.txt:4 (find_package):
By not providing "Findament_cmake_auto.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"ament_cmake_auto", but CMake did not find one.
Could not find a package configuration file provided by "ament_cmake_auto"
with any of the following names:
ament_cmake_autoConfig.cmake
ament_cmake_auto-config.cmake
Add the installation prefix of "ament_cmake_auto" to CMAKE_PREFIX_PATH or
set "ament_cmake_auto_DIR" to a directory containing one of the above
files. If "ament_cmake_auto" provides a separate development package or
SDK, be sure it has been installed.
solved
I saw in the readme that there is some interest in canbus support. Any chance that this is in the works?
Is there a good example how to control two motors for differential drive robot ? I would like to publish Twist message to cmd_val topic to control velocity of two motors.
Hi I know this repositary is very old but i wonder is this compatible with firmware 5.6 or not.
I'm trying to move over to humble, and I've managed to get all the return types fixed (as seen in #11) - I made 2 check functions, not sure that's the best way to go about it..
However, now I'm getting this error:
https://github.com/MSDRobotics/odrive_ros2_control/tree/devel/odrive_hardware_interface
Anyone have any ideas?
hi, i have ros2 foxy, i have cloned in a new workspace with the following link "git clone -b foxy-fw-v0.5.3 https://github.com/Factor-Robotics/odrive_ros2_control.git".
then "colcon build" and then i follow the wiki, i have launched "ros2 launch odrive_demo_bringup odrive_multi_interface.launch.py" and then in another terminal i have published "ros2 topic pub -r 100 /joint0_velocity_controller/commands std_msgs/Float64MultiArray "data: [1]" but motor doesn't spin, and in ros2 topic list i don't see joint0_velocity_controller.
and after 30 seconds, in the terminal where i have launched the node, output an error i think.
can you please help me?
Hello everyone, I am trying to make a differential robot, with odrive I currently install version 0.5.3 because 0.5.4 did not work with their library, but I was able to try the example they have without problems. but when trying to change and use diff_drive_controller I always get the same:
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [ros2_control_node-1]: process started with pid [22716]
[INFO] [robot_state_publisher-2]: process started with pid [22718]
[INFO] [spawner.py-3]: process started with pid [22720]
[INFO] [spawner.py-4]: process started with pid [22722]
[robot_state_publisher-2] Parsing robot urdf xml string.
[robot_state_publisher-2] Link base_link had 4 children
[robot_state_publisher-2] Link caster_frontal_wheel had 0 children
[robot_state_publisher-2] Link caster_rear_wheel had 0 children
[robot_state_publisher-2] Link left_wheel had 0 children
[robot_state_publisher-2] Link right_wheel had 0 children
[robot_state_publisher-2] [INFO] [1648330252.914258134] [robot_state_publisher]: got segment base_link
[robot_state_publisher-2] [INFO] [1648330252.914436006] [robot_state_publisher]: got segment caster_frontal_wheel
[robot_state_publisher-2] [INFO] [1648330252.914466840] [robot_state_publisher]: got segment caster_rear_wheel
[robot_state_publisher-2] [INFO] [1648330252.914489942] [robot_state_publisher]: got segment dummy
[robot_state_publisher-2] [INFO] [1648330252.914506869] [robot_state_publisher]: got segment left_wheel
[robot_state_publisher-2] [INFO] [1648330252.914523963] [robot_state_publisher]: got segment right_wheel
[ros2_control_node-1] terminate called after throwing an instance of 'std::out_of_range'
[ros2_control_node-1] what(): _Map_base::at
[spawner.py-3] [INFO] [1648330253.238620636] [spawner_joint_state_broadcaster]: Waiting for /controller_manager services
[spawner.py-4] [INFO] [1648330253.382559544] [spawner_mk2_base_controller]: Waiting for /controller_manager services
[ERROR] [ros2_control_node-1]: process has died [pid 22716, exit code -6, cmd '/home/paloverde/mk2_ros2/install/controller_manager/lib/controller_manager/ros2_control_node --ros-args --params-file /tmp/launch_params_k2w8y3jv --params-file /home/paloverde/mk2_p2/install/odrive_bringup/share/odrive_bringup/config/odrive_diff__controllers.yaml'].
[spawner.py-3] [INFO] [1648330255.258554065] [spawner_joint_state_broadcaster]: Waiting for /controller_manager services
[spawner.py-4] [INFO] [1648330255.403404351] [spawner_mk2_base_controller]: Waiting for /controller_manager services
[spawner.py-3] [INFO] [1648330257.279708970] [spawner_joint_state_broadcaster]: Waiting for /controller_manager services
[spawner.py-4] [INFO] [1648330257.424464528] [spawner_mk2_base_controller]: Waiting for /controller_manager services
[spawner.py-3] [INFO] [1648330259.301082063] [spawner_joint_state_broadcaster]: Waiting for /controller_manager services
[spawner.py-4] [INFO] [1648330259.446024642] [spawner_mk2_base_controller]: Waiting for /controller_manager services
[spawner.py-3] [INFO] [1648330261.322128338] [spawner_joint_state_broadcaster]: Waiting for /controller_manager services
[spawner.py-4] [INFO] [1648330261.466963012] [spawner_mk2_base_controller]: Waiting for /controller_manager services
[spawner.py-3] [ERROR] [1648330263.343010495] [spawner_joint_state_broadcaster]: Controller manager not available
[ERROR] [spawner.py-3]: process has died [pid 22720, exit code 1, cmd '/home/paloverde/mk2_ros2/install/controller_manager/lib/controller_manager/spawner.py joint_state_broadcaster --ros-args'].
[spawner.py-4] [ERROR] [1648330263.487450622] [spawner_mk2_base_controller]: Controller manager not available
[ERROR] [spawner.py-4]: process has died [pid 22722, exit code 1, cmd '/home/paloverde/mk2_ros2/install/controller_manager/lib/controller_manager/spawner.py mk2_base_controller --ros-args'].
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[robot_state_publisher-2] [INFO] [1648330266.007189717] [rclcpp]: signal_handler(signal_value=2)
[INFO] [robot_state_publisher-2]: process has finished cleanly [pid 22718]
also use the example from: rosbot
with the same result.
Has anyone had a similar problem? Or do you know what could be causing this problem?
thanks for you help
Hi, I am trying to update the endpoint file for firmware 0.6.9. Odrive provides the flat endpoint file with CRC and all endpoint IDs at this source https://docs.odriverobotics.com/releases/firmware. However I do not know how to get the per_axis_offset.... can you explain what this is? In a another issue post it was stated that odrivetool generate-code doesn't work for 0.5.3 #2 and (odriverobotics/ODrive#593) but how was the endpoint file generated for this then?
Hi, is there a possibility to use this package for galactic distro?
thank you for your contribution.
I'm using ros2 galactic, and trying to use your lib.
but when I try to build the package, I got
so I tried to migrate it to galactic as mentioned here in ros2-conttrol framework.
this is the package after editing according to the ros2-control migration document,
but I got this error
I'm knew to programming and couldn't solve it, do you have any idea how to solve it?
hey i have run my odrive with ros2 control and it works fine and i drive my robot around nut i face this issue which is the odrive quit and stop response ??
the error is [ros2_control_node-1] [ERROR] [1686792683.910642175] [ODriveHardwareInterface]: LIBUSB_ERROR_IO
i have tested the joystick by ros2 topic echo /diffbot_base_controller/cmd_vel_unstamped
and the data its send from the joystick so the error is from the odrive i use different cable but the same issue!!
i use odrive 3.6 56v
ubuntu 22.04
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.