Yonohub: Autonomous Vehicles Using Blocks

Ibrahim Essam
YonoHub
Published in
8 min readApr 19, 2020

For the past weeks, I had the opportunity to try one of the most promising innovative products in the automotive industry and I would like to share my experience and a quick demo with you.

Welcome to Yonohub!

What is Yonohub?

“ Yonohub is a web-based cloud system for building, sharing and evaluating complex autonomous vehicle systems that consist of many building blocks. Yonohub features a drag-and-drop tool to build complex systems, a marketplace to share and monetize blocks, a builder for custom development environments, and much more.”

Yonohub offers several powerful and easy-to-use apps to support developers and researchers through the entire process of building autonomous vehicles: developing algorithms using Jupyter Notebook, deploying and testing them using YonoArc, scheduling overnight training jobs using YonoJobs, sharing and selling the algorithms on YonoStore.

Yonohub Apps

That’s not all. As you can see, there is also the popular GitLab and Tensoboard, YonoDrive as the data manager of Yonohub, and YonoEBuilder.

With YonoEBuilder, you don’t have to worry about your algorithm dependencies anymore. With just a few clicks, build your environment using a variety of package managers (APT, pip, or Conda) and share it with your teams or customers.

One of the apps I was really thrilled to try is YonoArc. You can simulate and test different algorithms with different datasets and all what you need to do is to drag and drop blocks. Cool, isn’t it?

The app comes with some free blocks: Carla Simulator, Gazebo Simulator, YOLO Object Detection, SSD Object Detection, KITTI Datasets, Berkeley DeepDrive Datasets, and much more.

And of course, you can create your own blocks using YonoArc’s Python or Octave simple APIs, or even import existing ROS nodes developed in C++ or Python. If you are a ROS fan like me, you are going to love that!

Let me share with you a quick demo in which I used an open source code from OSRF. It is using Gazebo to simulate a Prius hybrid car with 4 cameras, a 16 beam lidar on the roof, 8 ultrasonic sensors, and 2 planar lidars. All these sensors can be visualized using RViz which is already available as a free YonoArc block. The car’s throttle, brake, steering, and transmission are easily controlled using another block that I have also created.

The Gazebo world file is a model for Mcity and a freeway interchange. And you can use the Gazebo models repository to include many other models for cars, humans, buildings, and much more.

Let me show you how you can do that in more details.

Create Gazebo Simulation Environment

Any block needs an environment, so I used YonoEBuilder to create an environment for the Gazebo block:

  • Open YonoEBuilder by clicking its icon on Yonohub’s main view.
  • Click Create new environment. All the environments come with ROS Melodic pre-installed.
  • Check the “Gazebo Simulator” checkbox to make sure you have it in the environment.
  • Check “NVIDIA Drivers and CUDA” to give GPU access to your block.
Creating the Gazebo Environment Using YonoEbuilder

Under the Packages tab, we can install any required package for our block. For our demo we don’t have any required packages, so we are going to skip this.

Creating the Gazebo Environment Using YonoEBuilder

Now everything is ready. Let’s click “Build” and let YonoEBuilder do its job. Let’s grab a coffee and wait till the environment status changes from Building to Ready.

Create Gazebo Simulation Block

Let’s go to YonoArc and open the Block Manager which can be found here.

From the Block Manager page, let’s click “Create Project” and fill the required fields. First, don’t forget to choose the environment we created in the above steps. Then, for the source code, we can use the following GitLab repo which contains a modified version of the car demo workspace with Gazebo 9, and ROS Melodic support. Now we can click Create.

The next step is to build the project. From the Block Manager page, click Build next to our new project.

After building the project, let’s switch to the Blocks tab and select our project. Here we can configure our block ports, resources requirements, permissions, and properties. For the Resource Model, let’s choose “GK0.1 (CPU: 0.4 Cores, RAM: 6.1 GB )” because this model offers a Tesla K80 GPU.

The Car demo package contains a ROS launch file, this launch file is responsible for starting Gazebo, loading the world, spawning the models, and starting all the required ROS nodes. For more info about ROS launch files and how to use them, please check the ROS documentation.

The next step is to define all the block ports. We can control the car by publishing a ROS message of type prius_msg/Control on the /Prius topic. How can we translate this to a YonoArc port?

Under Advanced Inofrmation → Interface → Inputs Ports, let’s define an input port like this:

  • Name: Control → Port name: We can call it whatever we want.
  • Message: prius_msgs/Control → ROS Message Type
  • ROS Name: /Prius → ROS topic name
  • Key: control → Not used in this Block but we will explain it later.

And the same steps for the outputs ports.

Gazebo Block Inputs and Outputs

Now, the Gazebo block is ready to be saved and released. From the Projects tab, let’s click the more options icon for our project and click Release.

The ultimate goal is to allow the car to drive itself autonomously, but let’s start with a manual control block in order to collect the training data. By using the YonoArc Python API, I developed a block to send control messages to the Gazebo block, depending on the buttons clicked by the user.

The API of YonoArc is event-driven. A block is represented by a single class that implements one or more event handlers. It is important to note that every port or property has a unique key that you select while creating the block on the User Interface. This is to allow the block to know on which port a particular message is received and the values of the different properties.

Example Block Using YonoArc Python API

Let’s start Jupyter to implement our block.

  • Click the Jupyter Notebook icon on Yonohub’s main view.
  • Select the YonoCommons CPU environment since we don’t need any special needs for our environment.
  • Select the C1 resource model since we only need Jupyter Notebook to implement the block.
  • Click Launch. Wait until Jupyter Notebook starts.

Now let’s create a folder for the new block and write our code:

  • Click New → Folder at the upper-right corner. A folder named Untitled Folder is created.
  • Rename the folder to VehicleControlBlock by selecting the folder and clicking Rename.
  • Navigate into the folder by clicking its name.
  • Click New → Python 3 to create a new ipynb file for Python 3 code. The file opens in a new tab.
  • Rename the file from Untitled to car_demo_control by clicking its name at the top.
  • Paste the following source code into the the first cell in the notebook.
Vehicle Control Block Source Code

In the above code, we are using two event handlers from YonoArc API.

  • on_start(self): here we initialize our message fields
  • on_button_clicked(self): here we handle the different buttons actions.

First of all, we import theControl message from theprius_msgs package. As mentioned before, the input port to the Gazebo block use the same Message type.

The definition of the Control message can be found in the prius_msgs ROS package.

Header header
float64 throttle # Range 0 to 1, 1 is max
float64 brake # Range 0 to 1, 1 is max brake
float64 steer # Range -1 to +1, +1 is maximum left turn
uint8 NO_COMMAND=0
uint8 NEUTRAL=1
uint8 FORWARD=2
uint8 REVERSE=3
uint8 shift_gears

After constructing our output message, we can publish it using self.publish(port_key, message).

Don’t worry about all these keys, we will define them in our block during creation.

Let’s create our block, but this time as a Custom Block.

  • From YonoArc , click the + button on the upper-left corner and drag the Custom Block from the Others toolbox to the canvas.
  • Click the settings icon on the custom block. Set the attributes of the block as follows:

Name: Car Vehicle Control

Description: This block controls the Prius car in the Gazebo block.

Block Type: YonoArc API Blocks

Folder Path: Click Browse then select the VehicleControlBlock folder and click Open.

File Path: Click Browse then select the VehicleControlBlock/car_demo_control.ipynb file and click Open. YonoArc will automatically convert this file to a .py file before being executed.

Class Name: CarDemoControl. This is the name of the class representing the block.

Output Ports:

A single port with the following attributes:

  • Port Name: Control
  • Port Key: cmsg. This key is used to publish the Control Message self.publish('cmsg’, controlmsg)
  • Port Message: prius_msgs/Control.

Properties:

Add the first property with the following attributes:

  • Type: button
  • Name: Forward
  • Key: forward.

Click Create property. The button will be added below the block description. Let’s also not forget to create the other buttons Reverse, Steer, and Stop with the keys reverse, steer, and stop respectively. Finally, we need to add two more numeric properties for the steering value and the throttle.

  • Type: number
  • Name: Steering Angle
  • Key: steerval
  • Default: 0, Min: -1, Max: 1

Git Repositories of Messages:

Here we need to source all the messages used by the block. Normally, the 3 default repos contain all the common messages. but if we are using a custom ROS message, we should add the messages repo here.

Execution Mode: Async

Environment: YonoCommons — CPU.

Resource Model: C0.1 x 3.

Now all the blocks are ready, so let’s connect everything together. I also dragged some other blocks like YOLO, RViz, and Video Viewers.

YonoArc Pipeline

The running pipeline, as you can see in the video above, is simple yet powerful. It introduces one of the greatest features of Yonohub, which is connecting different blocks, fully abstracted from their different programming languages, environments, or resources requirements. You can also reuse theses blocks in any pipeline, share them with your teams, sell them on YonoStore.

My overall experience with Yonohub was really pleasing. I wouldn’t imagine combining a powerful deep learning algorithm like YOLO with ROS & Gazebo simulation as easy as that. This makes me believe that it will soon be an essential platform for everyone working on autonomous vehicles. I’m thrilled to witness that.

As you have already seen, Yonohub is a great place to fast prototype your research work/models. So I would like to invite you all to give Yohohub a try in your next autonomous vehicles project.

--

--