Installation of NXP Gazebo [OLD]
[WORK IN PROGRESS] NOTE: Add more info about scripts being run - Landon
Last updated
[WORK IN PROGRESS] NOTE: Add more info about scripts being run - Landon
Last updated
These are draft instructions and may change or be updated. Please check back here regularly.
If you run into issues with this guide, please use the Contact
section in the sidebar on the left to get help.
You can install by using nxp_desktop.sh shell by downloading the file at
You can do so easily by running the following git clone command using the link from the git repo:
Now you should see the desktop_installs
folder in your home folder:
After downloading the file you may need to make it executable. You can do so by entering the desktop_installs
directory and running a chmod
command:
Now you should see that the nxp_desktop.sh
file is highlighted green. This means that it has executable permissions.
Now, we want to run this file to set up our desktop environment. It will ask you for your Ubuntu user password; just type that in when it asks for it. To run the file, run the following command and you should get the expected output:
You should now see that your background has changed and the command has given you the All done!
signal. Great! Now let's run the workspace setup to get Gazebo, PX4, and ROS installed.
First, we will need to navigate to the new workspace folder created by the nxp_desktop.sh
install script. The workspace folder is at ~/git/
. Inside of that workspace folder, there is a script that will set up ROS2 and all necessary dependecies for you. That install script is located at ~/git/nxp_gazebo/scripts/
. To get there, run the following commands:
Now, we will need to run the foxy_install.sh
file to set up our software. To start, run the following command and make sure you get the expected output:
Note: This command will take a long time to finish since it is installing ROS2.
Once you get the expected output from ./foxy_install.sh
, you'll want to add a line to your ~/.bashrc
. Follow the instructions below:
Then, run the following commands and make sure you get the expected output:
In order to transfer simulated Pixy camera data from ROS2 to simulated PX4, we need to install some software. We are following the guide at the link below, but we will go over the commands in detail here.
Clone the project from Github:
You should get the expected output from these commands shown below:
Next, we will run some commands to build and install Fast-DDS. Run the following commands:
You should get a message stating [100%] Built target fastrtps
once make -j$(nproc --all)
is finished, and you should get the expected output shown below after you run sudo make install
:
Next, we will install Fast-RTPS-Gen. To do so, run the following command and make sure you get the expected output:
If you got the expected output, great! We will move on to building our ROS2 workspace.
Now, we will want to navigate to the ROS2 workspace and build all of the packages inside it. First, we will change directories to the ~/git/nxp_ros2_ws/
and then run some build commands. Run the commands below and make sure that you get the expected output:
Once we have built all of our ROS2 workspace, we will want to source the setup.bash for the workspace. We also want to make sure that all of our library paths are properly sourced. To do so, we will add some lines to the end of our ~/.bashrc
. Add the following lines to the end of your ~/.bashrc
:
You can do so with nano
or vim
. You can follow the nano
instructions from earlier in the guide if you need help doing so. To make sure your ~/.bashrc
looks correct, run the following command and then check if you get the expected output:
Now, you'll want to source that ~/.bashrc
by running the following command:
Once you're done building your ROS2 workspace and sourcing the ~/.bashrc
, we will move on to building the PX4 binary for our simulation!
The PX4 source code is located at ~/git/PX4-Autopilot. To build the PX4 source, we will want to change directories and run the build command for px4_sitl_rtps gazebo
. This will give the ROS2 workspace a PX4 binary to run for our simulated NXP Cup car. Run the following commands to build PX4 and make sure you get the expected output:
If you get the expected output, stay vigilant! We only have one more command to run. We need to install xterm
for the PX4 shell that runs when we boot up the simulation. To do so, run the following command:
Once you have done that, you're finished setting up the NXP Cup simulation! Congratulations! We know that it is quite a sophisticated process at the moment, but we will work on improving the process in the future. Stay tuned for updates to this page. In the meantime, if you have any issues, make sure to contact us using the contact page on this Gitbook:
ContactNext, we will move on to running the Gazebo simulation for the first time to confirm that everything works correctly.
To run the Gazebo simulation, we suggest you first restart your VM or PC and/or log out and log back in. Once you've done so, you can run the following command to start the simulation stack and check to see if you get the expected result:
Hooray! You have successfully setup your NXP Cup Gazebo Simulation. For more documentation on how to use the Gazebo simulation, move on to the next section using the buttons below or navigate by using the sidebar on the left.