ROS2 - Helping the community

Hey all,

How are you doing these days?

For the last couple of months, I've been learning and implementing all ROS2 index tutorials.

ROS stands for Robotic Operation System.

But it stands for a whole lot more!

From a state of the art C++ implementations, through tons of packages with well-documented code, and community support. And all that sugar is for free :)


Today I'll lay out the first building block for my next project, an Autonomous DJI Tello drone.

Lets begin!

  • For best practice, and to experience working with cutting edge tech - I am using ROS2.
  • There are several tello_drivers out there, but I've found this repository, which claims to implement a tello_driver for ROS2.

1st step

2nd step

  • Getting the code and creating a ROS2 workspace
source /opt/ros/foxy/setup.bash  
mkdir -p ~/tello_ws/src  
cd ~/tello_ws/src  
gh repo clone GalBrandwine/tello_ros # Using the GitHub CLI, otherwise, just use git clone.  
git clone https://github.com/ptrmu/ros2_shared.git  
cd ..  
colcon build  
  • As expected, it failed.

    These things never work on the first time, so let's make it work:

    • It seemed that I didn't have Gazebo installed:

      so sudo apt install ros-foxy-gazebo-ros-pkgs did the trick.

      The gazebo is a strong simulation/Emulation tool.

      Lets colcon build again...

DONE!

3rd step

Setting up an IDE:

I like to work with vscode.

In order to open vscode with all PATH's configured:

cd ~/tello_ws/  
. install/setup.bash # source to this ROS2 layout
code  

I LOVE vscode's configurability, for example - one can add custom tasks that can be called, and automate things. This can be configured by the tasks.json:

I have added build and clean tasks so the vscode can build the ROS2 workspace properly.

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "shell",
            "label": "source",
            "command":["cd ~/tello_ws/ && . install/setup.bash"],
        },
        {
            "type": "shell",
            "label": "clean",
            "command":["cd ~/tello_ws/ && rm -rf build/ install/ log/ && unset AMENT_PREFIX_PATH && unset CMAKE_PREFIX_PATH"],
        },
        {
            "type": "shell",
            "label": "colcon build",
            "command":["source /opt/ros/foxy/setup.bash  && cd ~/tello_ws/ && colcon build --cmake-args -DCMAKE_BUILD_TYPE=Debug && . install/setup.bash"],
        },
    ]
}

This tasks.json sits in ~/tello_ws/.vscode/.

Next, I always like to add keybindings to my tasks:

    {
        "key": "f6",
        "command": "workbench.action.tasks.runTask",
        "args": "clean",
    },
    {
        "key": "f7",
        "command": "workbench.action.tasks.runTask",
        "args": "colcon build"
    },

To keybindings.json file can be found in ~/.config/Code/User/.

To make sure I was ready to start playing with this, I pressed f7 - and as expected, the workspace was built successfully:

That's it!

4th step

Getting to know this tello_driver:

In their (well written) README.md, there's a run simulation section:

cd ~/tello_ws  
source install/setup.bash  
export GAZEBO_MODEL_PATH=${PWD}/install/tello_gazebo/share/tello_gazebo/models  
source /usr/share/gazebo/setup.sh  
ros2 launch tello_gazebo simple_launch.py  

And voila! a GAZEBO simulation pops, with a drone object inside it!

.

Having a simulation is super important!

Especially if one's work involves robotics or real-world sensing.

  • Once I had the simulation running, I dug deeper, to find out how much this thing actually works.
    • In a new terminal:
cd ~/tello_ws/  
. install/setup.bash # source my ROS2 layout
rqt # This will open for us ROS2 diagnostic & monitoring tool  
  • From the Plugins pannel I choose services->ServiceCaller,

  • Then I entered the 'takeoff' expression, and pressed Call:

WOW, RIGHT?!

This simulation will help a lot to those who seek to avoid destroying their own equipment.

SideNote

I did notice some missing data that I wished to be simulated:

  • Drone position
  • Camera feed

These things can be easily added, I think this is where I come in :)

5th step

Testing this driver in the real world:

Final thoughts

  • This ROS2 tello_driver does seem to work.
  • It is implemented in C++, which is great!
  • When flying for real (not simulation) the ROS2 tello_driver streams the video feed quite good.
  • Unfortunately, this ROS2 tello_driver doesn't retransmit backward IMU nor POSITION estimation. While other tello drivers do perform that(this one is a good examlpe), they have no ROS2 support. So I guess I have to add these capabilities myself.

It seems that I have quite a lot of work in fitting this ROS2 tello_driver to my needs.

Luckily, I'm not going anywhere :)

Cheers, Gal.