ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Retrofit existing 4WS vehicle with ROS 2

asked 2023-04-12 01:38:22 -0600

zzm gravatar image

I’m completely new to ROS and have done some reading to try and understand how I should approach this.

I have an existing 4 wheel steer vehicle with all the different drive modes you need. Moving like a crab (all wheels same angle), pivoting around its on center point, car steer etc. Looking in to retrofitting it with ROS2 for autonomous driving and need some advice on the setup approach for this.

Since all the drive modes and calculations for that already exist, is it possible to only expose say velocity and drive angle to the vehicle and use the existing functionality or do I need to expose every single wheel and develop this kind of functionality again in ros2_control?

Would it be possible to skip ros2_control since most of that already exist in the vehicle control system and connect it directly to NAV2 with a URDF of the vehicle setup?

edit retag flag offensive close merge delete


Anyone? please? :)

zzm gravatar image zzm  ( 2023-04-17 01:06:01 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2023-04-18 11:20:28 -0600

There are multiple ways to make your vehicle ROS/ROS2 compatible. You don't necessarily need to use ros2_control to get an autonomous vehicle working. I would suggest following steps towards reaching a fully autonomous vehicle -

  1. Make sure you can operate the vehicle with ROS2 velocity commands (geometry_msgs/Twist). This will involve writing some ROS2 driver on top of a serial/CANbus/Modbus/other interface
  2. See if you can get wheel Odometry out of the vehicle, at this point you can verify how good the vehicle is at tracking the velocities sent in step 1
  3. What accuracy do you need for your application? As per that you can make decision about using a 3D-LiDAR/Camera or just GPS+IMU (and some safety related sensors of course)
  4. Depending on previous steps, setup appropriate transformations (TF2) as per nav2 requirements.
  5. Would be good to have all this validated with nav2 in a simple Gazebo/Iginition simulation
  6. If everything works, just put it on the robot and it should be good to go (several hours of troubleshooting later)

If it is just a point to point navigation without obstacle avoidance or LiDAR based localization, you don't necessarily even need nav2. Neither ros2 control, or nav2 are necessary for having a ROS2 powered autonomous robot. Hope it helps.

edit flag offensive delete link more


Thanks for your answer.

Since I plan on sending a single velocity and angle to the vehicle and utilizing my current drive modes (which calculates each individual wheel angle and velocity) already implemented in the vehicle controller, would sending back an odometry for each wheel still be needed or how does this work? I understand that if you calculate each wheel velocity (steering and drive) in ros2 that getting the odometry feedback for each wheel is what you want.

I plan on using a system that gives back the absolute coordinates of the vehicle, x,y and angle and after that try implementing it with a Lidar.

You say that if it's only point to point without obstacle avoidance or lidar loc I dont need nav2. I thought it was Nav2 taking care of all kinds of navigation but I'm clearly wrong here. If I'm not using ...(more)

zzm gravatar image zzm  ( 2023-04-19 01:50:13 -0600 )edit

The odometry feedback is useful because you can fuse it with other sensors such as an IMU/GPS, (or LiDAR as you're planning) to get a good estimate of the absolute vehicle coordinates that you are looking for.

Nav2 can still be used, but one of main advantages of Nav2 is a rich arsenal of SLAM/localization/planners that come with it. But if you'e not planning to use these features, it might be easier to just setup localization with EKF and write a simple point follower ROS2 script. Again, depends on your comfort and programming experience.

Put it this way - if you have limited programming experience (even outside of ROS), go with Nav2. But If you're comfortable writing code but don't fully understand ROS2 system, it might be easier to setup EKF (robot_localization package) with a waypoint navigator script (with ROS2 pub/subs which you ...(more)

Gaurav Gupta gravatar image Gaurav Gupta  ( 2023-04-19 02:34:16 -0600 )edit

Thank you!

So EKF node publishes cmd_vel based on the fused sensor data inputs and then moves to the navigation point sent by the waypoint navigation script?

zzm gravatar image zzm  ( 2023-04-19 03:59:58 -0600 )edit

Question Tools



Asked: 2023-04-12 01:38:22 -0600

Seen: 169 times

Last updated: Apr 18 '23