UnityROS2 project with ROS2 Master + Navigation2 + TEB

First of al, thank you Erik for guiding me here ;-).
I like your project and would like to use it to let a vehicle drive autonomously and avoid obstacles.
I have your project running (Unity project + docker img).
As I would like to use the Time Elastic Band local planner, I had to build ROS2 from source (from Master branch) and got TEB working in a separate Turtlebot3 demo.
My first goal is to use your Unity application and replace your docker environment with my ROS2 Master + Navigation2 + TEB environment.
I am experienced with Unity (see www.mexicaninvaders.com) and ROS2, but relatively new to Navigation2 stack => Would it be possible to point me to a strategy how I can do this best (for example: I am struggling a bit with launch and parameter files).
So I do not require a pre-chewed solution, but merely a strategy on how to approach this problem ;-).

Ttack så mycket och hälsningar från Nya Zeeland!


Hi Dirk!

Sorry about the late response. I finally got around to testing TEB with navigation2 and Unity and got it to work (for the most part) for an inhouse project yesterday. Have you made any progress yourself?

I will probably have time to update the open source project with TEB support over the weekend if you want me to :slight_smile:

Hi Sam,

I got TEB working with the turtlebot model in Unity.
I used the SLAM toolbox to create a map, and polished it up with GIMP.
The difficult thing was getting things right with launch files.
Also, when I was running the demo, the model’s position in rviz was jittering.
So then I disabled amcl, which caused an error: " [controller_server]: Extrapolation Error: Lookup would require extrapolation into the future."
This was finally solved by launching a static_transform_publisher, to handle a transform from odom to map.
Now I have created my own vehicle model in Unity, with Ackermann steering.
At the moment I am checking if I can replace the turtlebot model with my own vehicle.
The idea is to eventually plan/drive a route with a real vehicle, based on odometry/IMU/GPS (that’s why I do not need amcl). One of the questions I already have, is if I create a map based on for example Google maps, how I can make sure all coordinate systems match?


I’m pretty there already is a static transform publisher in the Unity example (that publishes to tf from Unity). That could possibly explain the jitter when running amcl.

Not sure what the cause of the lookup error could be. Is it only for TEB and not dwb in the original navigation example?

We have handled this type of thing before by placing a GPS origo on a game object with manually specified longitude and latitude in Unity. The simulated GPS sensor used that as reference. We also had a dedicated node outside Unity that handled all the conversions between GPS and local ROS coordinates for the rest of the system.