mateusmenezes95 / omnidirectional_controllers Goto Github PK
View Code? Open in Web Editor NEWROS2 controllers for Omnidirectional robots with three wheels
License: MIT License
ROS2 controllers for Omnidirectional robots with three wheels
License: MIT License
I see that there is a variable in the kinematics.hpp file called OMNI_ROBOT_MAX_WHEELS which is equal to 4. Upon analyzing the code it looks like the kinematics equations are only for 3 wheel drive robots which suggests that this controller would not work out of the box with a 4WD robot, would I be correct in thinking this?
On typing this command:
rosdep install --from-paths src/omnidirectional_controllers --ignore-src -r -y --rosdistro foxy
I get this error:
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
omnidirectional_controllers: Cannot locate rosdep definition for [ament_add_gmock]
And on typing this command:
colcon build --symlink-install --event-handlers console_direct+
I get this error:
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp: In member function ‘void omnidirectional_controllers::OmnidirectionalController::velocityCommandUnstampedCallback(geometry_msgs::msg::Twist_<std::allocator<void> >::SharedPtr)’:
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:324:22: error: base operand of ‘->’ is not a pointer
324 | RCLCPP_WARN(node_->get_logger(), "Can't accept new commands. subscriber is inactive");
| ^~
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:324:22: error: base operand of ‘->’ is not a pointer
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:324:5: error: template argument 1 is invalid
324 | RCLCPP_WARN(node_->get_logger(), "Can't accept new commands. subscriber is inactive");
| ^~~~~~~~~~~
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:324:5: error: template argument 1 is invalid
324 | RCLCPP_WARN(node_->get_logger(), "Can't accept new commands. subscriber is inactive");
| ^~~~~~~~~~~
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:324:5: error: template argument 1 is invalid
324 | RCLCPP_WARN(node_->get_logger(), "Can't accept new commands. subscriber is inactive");
| ^~~~~~~~~~~
In file included from /opt/ros/galactic/include/rclcpp/client.hpp:40,
from /opt/ros/galactic/include/rclcpp/callback_group.hpp:23,
from /opt/ros/galactic/include/rclcpp/any_executable.hpp:20,
from /opt/ros/galactic/include/rclcpp/memory_strategy.hpp:25,
from /opt/ros/galactic/include/rclcpp/memory_strategies.hpp:18,
from /opt/ros/galactic/include/rclcpp/executor_options.hpp:20,
from /opt/ros/galactic/include/rclcpp/executor.hpp:36,
from /opt/ros/galactic/include/rclcpp/executors/multi_threaded_executor.hpp:26,
from /opt/ros/galactic/include/rclcpp/executors.hpp:21,
from /opt/ros/galactic/include/rclcpp/rclcpp.hpp:156,
from /opt/ros/galactic/include/controller_interface/controller_interface.hpp:28,
from /home/aamod/dev_ws/src/omnidirectional_controllers/include/omnidirectional_controllers/omnidirectional_controller.hpp:30,
from /home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:23:
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:324:22: error: base operand of ‘->’ is not a pointer
324 | RCLCPP_WARN(node_->get_logger(), "Can't accept new commands. subscriber is inactive");
| ^~
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:324:22: error: base operand of ‘->’ is not a pointer
324 | RCLCPP_WARN(node_->get_logger(), "Can't accept new commands. subscriber is inactive");
| ^~
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:329:39: error: base operand of ‘->’ is not a pointer
329 | this->cmd_vel_->header.stamp = node_->get_clock()->now();
| ^~
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp: In member function ‘virtual controller_interface::return_type omnidirectional_controllers::OmnidirectionalController::update(const rclcpp::Time&, const rclcpp::Duration&)’:
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:335:22: error: base operand of ‘->’ is not a pointer
335 | auto logger = node_->get_logger();
| ^~
In file included from /opt/ros/galactic/include/rclcpp/service.hpp:34,
from /opt/ros/galactic/include/rclcpp/callback_group.hpp:25,
from /opt/ros/galactic/include/rclcpp/any_executable.hpp:20,
from /opt/ros/galactic/include/rclcpp/memory_strategy.hpp:25,
from /opt/ros/galactic/include/rclcpp/memory_strategies.hpp:18,
from /opt/ros/galactic/include/rclcpp/executor_options.hpp:20,
from /opt/ros/galactic/include/rclcpp/executor.hpp:36,
from /opt/ros/galactic/include/rclcpp/executors/multi_threaded_executor.hpp:26,
from /opt/ros/galactic/include/rclcpp/executors.hpp:21,
from /opt/ros/galactic/include/rclcpp/rclcpp.hpp:156,
from /opt/ros/galactic/include/controller_interface/controller_interface.hpp:28,
from /home/aamod/dev_ws/src/omnidirectional_controllers/include/omnidirectional_controllers/omnidirectional_controller.hpp:30,
from /home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:23:
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:358:7: error: template argument 1 is invalid
358 | RCLCPP_ERROR(logger, e.what());
| ^~~~~~~~~~~~
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:358:7: error: template argument 1 is invalid
358 | RCLCPP_ERROR(logger, e.what());
| ^~~~~~~~~~~~
/home/aamod/dev_ws/src/omnidirectional_controllers/src/omnidirectional_controller.cpp:358:7: error: template argument 1 is invalid
358 | RCLCPP_ERROR(logger, e.what());
| ^~~~~~~~~~~~
make[2]: *** [CMakeFiles/omnidirectional_controllers.dir/build.make:63: CMakeFiles/omnidirectional_controllers.dir/src/omnidirectional_controller.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:241: CMakeFiles/omnidirectional_controllers.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
---
Failed <<< omnidirectional_controllers [2.25s, exited with code 2]
Summary: 1 package finished [4.52s]
1 package failed: omnidirectional_controllers
1 package had stderr output: omnidirectional_controllers
I am a beginner in ROS so I do not know if this is trivial so please excuse my question if it is so.
Hello,
first of all, thank you for your wonderful work.
I am currently trying to use it for my own 3-wheel omnidirectional robot project under ROS 2 Humble. However, after successfully resolving an initial issue with the inclusion: #include "tf2/LinearMath/Quaternion.h" without difficulty. I am now encountering hundreds of error messages, all with the same origin:
error: ‘std::shared_ptr<rclcpp_lifecycle::LifecycleNode> controller_interface::ControllerInterfaceBase::node_’ is private within this context.
I cannot seem to figure out where the problem is, considering that the only modification I have made so far is adding tf2 and tf2_ros to the packages in the CMakeLists to address the previously mentioned dependency issue. Would you be able to shed some light on the matter?
Hello @mateusmenezes95 ,
I am trying to use your controller in addition of the topic_based_ros2_control hardware interface.
The thing is that on my real robot i do not need of state interface. Indeed I am controlling my robot in open loop. So as you can expect, i set the open_loop
param to True
and as i saw it in the omnidirectional_controller.cpp
it indeed unset the use of the state estimation tool.
However, in the omnidirectional_controller.cpp
the controller keep looking for a state_interface
even if the open_loop
is True
.
Or we could expect that only command would be send in open_loop
, so in other words, just needing command_interface
in the hardware_interface
and not also a state_interface
am i right?
So is it a bug? Did I miss something?
Here is what i expect to implement as hardware_interface
:
PS: Thank you again for this very useful work you have made
Your codes is useful ,but i meet some problems when i used it in my project.
I almost finish it,but i get this
[gzserver-4] [INFO] [1713712162.652976630] [gazebo_ros2_control]: Loading gazebo_ros2_control plugin
[gzserver-4] [INFO] [1713712162.654715763] [robot_0.gazebo_ros2_control]: Starting gazebo_ros2_control plugin in namespace: /robot_0
[gzserver-4] [INFO] [1713712162.654818903] [robot_0.gazebo_ros2_control]: Starting gazebo_ros2_control plugin in ros 2 node: gazebo_ros2_control
[gzserver-4] [INFO] [1713712162.656256463] [robot_0.gazebo_ros2_control]: connected to service!! robot_state_publisher
[gzserver-4] [INFO] [1713712162.656628341] [robot_0.gazebo_ros2_control]: Received urdf from param server, parsing...
[gzserver-4] [INFO] [1713712162.656658385] [robot_0.gazebo_ros2_control]: Loading parameter files /home/robot/ROS2_omni_gazebo/install/models/share/models/config/omni_robot.yaml
[gzserver-4] [INFO] [1713712162.661470477] [robot_0.gazebo_ros2_control]: Loading joint: left_wheel_robot_0
[gzserver-4] [INFO] [1713712162.661503793] [robot_0.gazebo_ros2_control]: State:
[gzserver-4] [INFO] [1713712162.661509935] [robot_0.gazebo_ros2_control]: position
[gzserver-4] [INFO] [1713712162.661514600] [robot_0.gazebo_ros2_control]: velocity
[gzserver-4] [INFO] [1713712162.661517598] [robot_0.gazebo_ros2_control]: Command:
[gzserver-4] [INFO] [1713712162.661548673] [robot_0.gazebo_ros2_control]: velocity
[gzserver-4] [INFO] [1713712162.661554499] [robot_0.gazebo_ros2_control]: Loading joint: back_wheel_robot_0
[gzserver-4] [INFO] [1713712162.661557957] [robot_0.gazebo_ros2_control]: State:
[gzserver-4] [INFO] [1713712162.661560698] [robot_0.gazebo_ros2_control]: position
[gzserver-4] [INFO] [1713712162.661563436] [robot_0.gazebo_ros2_control]: velocity
[gzserver-4] [INFO] [1713712162.661565992] [robot_0.gazebo_ros2_control]: Command:
[gzserver-4] [INFO] [1713712162.661581531] [robot_0.gazebo_ros2_control]: velocity
[gzserver-4] [INFO] [1713712162.661587194] [robot_0.gazebo_ros2_control]: Loading joint: right_wheel_robot_0
[gzserver-4] [INFO] [1713712162.661590127] [robot_0.gazebo_ros2_control]: State:
[gzserver-4] [INFO] [1713712162.661592801] [robot_0.gazebo_ros2_control]: position
[gzserver-4] [INFO] [1713712162.661595556] [robot_0.gazebo_ros2_control]: velocity
[gzserver-4] [INFO] [1713712162.661597968] [robot_0.gazebo_ros2_control]: Command:
[gzserver-4] [INFO] [1713712162.661613345] [robot_0.gazebo_ros2_control]: velocity
[gzserver-4] [INFO] [1713712162.661639976] [resource_manager]: Initialize hardware 'GazeboSystem'
[gzserver-4] [INFO] [1713712162.661714153] [resource_manager]: Successful initialization of hardware 'GazeboSystem'
[gzserver-4] [INFO] [1713712162.661757823] [resource_manager]: 'configure' hardware 'GazeboSystem'
[gzserver-4] [INFO] [1713712162.661762216] [resource_manager]: Successful 'configure' of hardware 'GazeboSystem'
[gzserver-4] [INFO] [1713712162.661765400] [resource_manager]: 'activate' hardware 'GazeboSystem'
[gzserver-4] [INFO] [1713712162.661768201] [resource_manager]: Successful 'activate' of hardware 'GazeboSystem'
[gzserver-4] [INFO] [1713712162.661808672] [robot_0.gazebo_ros2_control]: Loading controller_manager
[gzserver-4] [WARN] [1713712162.664435877] [robot_0.controller_manager]: 'update_rate' parameter not set, using default value.
[gzserver-4] [ERROR] [1713712162.667432065] [robot_0.gazebo_ros2_control]: controller manager doesn't have an update_rate parameter
There are the yaml codes, also your codes
controller_manager:
ros__parameters:
update_rate: 20 # Hz
use_sim_time: true
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster
omnidirectional_controller:
type: omnidirectional_controllers/OmnidirectionalController
omnidirectional_controller:
ros__parameters:
wheel_names:
- left_wheel_robot_0
- back_wheel_robot_0
- right_wheel_robot_0
robot_radius: 0.1
wheel_radius: 0.053112205
gamma: 30.0 # angle between body fixed y axis and the normal of wheel3
publish_rate: 50.0
odom_frame_id: odom
base_frame_id: base_link_robot_0
pose_covariance_diagonal : [0.001, 0.001, 0.001, 0.001, 0.001, 0.01]
twist_covariance_diagonal: [0.001, 0.001, 0.001, 0.001, 0.001, 0.01]
odom_numeric_integration_method: runge_kutta2
open_loop: false
enable_odom_tf: true
cmd_vel_timeout: 0.5
use_stamped_vel: false
And there is no omnidirectional_controller in the node list
Looking forward to your reply!
I am a newbie into this, so this might be a little naive doubt... But can you please help me fix this I have exactly followed the steps mentioned in the README and even installed Foxy as instructed.
ROS Version: ROS2 Foxy
Gazebo: Classic Gazebo 11
ros2_ws
:colcon build --symlink-install --event-handlers console_direct+
CMake Error at CMakeLists.txt:36 (find_package):
By not providing "Findcontroller_interface.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"controller_interface", but CMake did not find one.
Could not find a package configuration file provided by
"controller_interface" with any of the following names:
controller_interfaceConfig.cmake
controller_interface-config.cmake
Add the installation prefix of "controller_interface" to CMAKE_PREFIX_PATH
or set "controller_interface_DIR" to a directory containing one of the
above files. If "controller_interface" provides a separate development
package or SDK, be sure it has been installed.
---
Failed <<< omnidirectional_controllers [0.69s, exited with code 1]
Aborted <<< axebot_control [0.89s]
Aborted <<< axebot_description [1.10s]
Summary: 0 packages finished [3.96s]
1 package failed: omnidirectional_controllers
2 packages aborted: axebot_control axebot_description
1 package had stderr output: omnidirectional_controllers
1 package not processed
Hello @mateusmenezes95 ,
first of all, thank you for your work in enabling us to use your controller under ros2 Humble.
A bit of context:
I am working on the creation of a 3 wheel holonomic robot. I've managed to set up the whole navigation environment with Nav2, giving me the global speed control of the robot on /cmd_vel.
I'm now looking to get the speed for each of the motors (which your package seems to do).
Setup:
ROS2 Humble
Ubuntu 22.04
Classic Gazebo
The real robot
Problem:
I don't really understand how to use it. Indeed, in the example you give (Axebot) I don't see the ros2_control_node
used in the launch file, as used in the ros2_control example launch files , nor where the parameters are used (omnidirectional_controller.yaml).
I also didn't quite understand the role of GazeboSystem or how to install it to be able to use it (I obviously tried sudo apt install ros-humble-gazebo-ros2-control
).
If you could enlighten me on these matters I would be truly grateful.
Expected behaviour:
What I hope to be able to do with this package is to visualise the control of my robot under gazebo and above all, without using gazebo, launch the controller and go from my /cmd_vel
to /topic_wheel_commands
giving me the speed command for each of my wheels.
Note:
I've obviously already written my own node subscribing to /cmd_vel
and sending me the speed of each motor by inverse kinematics on a topic, but wanting to make a project as close as possible to the state of the art, it seemed a shame not to use ros2_control despite the trouble I'm having understanding its workings in detail.
##EDIT##
I manage to use it. I will now dig inside to fully understand it and not only using it out of the box.
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.