Comment on page
Overview of the NXP Gazebo stack [OLD]
[WORK IN PROGRESS]
This page is designed to help contestants understand the inner-workings of the NXP Gazebo simulation stack. As a contestant, you will only need to focus on a small set of files within this massive workspace. In order to reduce confusion, we have created a detailed outline of all of the files and folders in the stack, and have documented the specific files and folders that contestants will be working with in order to write self-driving algorithms for their simulated NXP Cup car.
The NXP Gazebo simulation stack uses a diverse set of software to enable the simulation of the Cup car. Thankfully, as NXP Cup contestants, you will only need to use specific portions of the stack to develop your self-driving software. The stack is located in the
~/git/folder and is set up as follows:
The src folder within the ROS2 workspace contains some PX4 specific ROS packages as well as the
To write self-driving code for the simulated NXP Cup car, you must be familiar with how PX4 runs modules. A brief overview will be be outlined in this section.
To develop your self-driving code, you'll want to navigate to the NXP-Autopilot directory. This directory contains the PX4 firmware. A look inside the NXP-Autopilot directory is below:
While there is a large amount of files and folders inside the PX4-Autopilot directory, there is only a single location that you need to use. The location is in the
~/ros2ws/NXP-Autopilot/src/examplesdirectory. This directory contains user-written and example modules for PX4. By placing your self-driving source code in this directory, you can easily add it to the PX4 SITL (Software In The Loop) build target. Thankfully, we have already included a simple example module that drives the simulated cup car around an oval track. The module is located at
~/ros2ws/NXP-Autopilot/src/examples/nxpcup/. An overview of the directory is located below:
Inside of the
nxpcupdirectory, you will see a few files that may look familiar if you have previously used a brushless NXP Cup car kit. The files here are provided for contestants to get a quick start with simulation. A description of each file is in the table below:
nxpcup_race.cpp, there is a function that receives vector information from the a simulated Pixy camera and returns speed and steer values. The vector information is received through a uORB topic and is nearly identical to the vector information sent by the Pixy over I2C.
At the moment, only up to two vectors are published to the uORB topic the example code subscribes to. In the future, we plan to support more than two vectors as well as intersection data so that the simulated Pixy cam is a 1-to-1 replacement in the code.
The source code uses a simple algorithm to extract speed and steer values from the supplied vector data to drive the car. We expect contestants to improve upon this algorithm and show us how fast their simulated NXP Cup car can go!
If you run into any discrepancies with this page, please contact us using the Contact page. A link to it is below.
In the next section, we will outline the steps to running this example code. Please follow the navigation at the bottom of the page or use the menu to the left.