51
README.md
51
README.md
@@ -4,10 +4,14 @@ By Sem van der Hoeven
|
|||||||
|
|
||||||
## Table of contents
|
## Table of contents
|
||||||
- [Introduction](#introduction)
|
- [Introduction](#introduction)
|
||||||
- [Installation on new flight computer](#installation-on-new-flight-computer)
|
- [Pin layout](#pin-layout)
|
||||||
- [Connecting to API](#connecting-to-api)
|
- [Connecting to API](#connecting-to-api)
|
||||||
|
- [Installing API](#installing-api)
|
||||||
|
- [Installation on new flight computer](#installation-on-new-flight-computer)
|
||||||
- [Building PX4 firmware](#building-px4-firmware)
|
- [Building PX4 firmware](#building-px4-firmware)
|
||||||
- [ROS2 nodes overview](#ros2-nodes-overview)
|
- [ROS2 nodes overview](#ros2-nodes-overview)
|
||||||
|
- [PX4 parameters](#px4-parameters)
|
||||||
|
- [Optical flow](#optical-flow)
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
This is the code for the 5G RCID of the 5G Hub. All ROS2 nodes and the API code can be found here. The flight computer currently already contains the latest version of the software.
|
This is the code for the 5G RCID of the 5G Hub. All ROS2 nodes and the API code can be found here. The flight computer currently already contains the latest version of the software.
|
||||||
@@ -15,13 +19,12 @@ This is the code for the 5G RCID of the 5G Hub. All ROS2 nodes and the API code
|
|||||||
- The code for the API can be found in the [api folder (api/)](/api/)
|
- The code for the API can be found in the [api folder (api/)](/api/)
|
||||||
- Further information about how the drone is built and how it works can be found in my report in the [docs folder (doc/)](/doc/)
|
- Further information about how the drone is built and how it works can be found in my report in the [docs folder (doc/)](/doc/)
|
||||||
|
|
||||||
To add new ROS2 functionality, you can edit the code, push to the repository, pull on the flight computer (10.100.0.40, password is `raspberrypi`) and build the ROS2 workspace again. An example of how to do this is shown below:
|
To add new ROS2 functionality, you can edit the code, push to the repository, pull on the flight computer (ubuntu@10.100.0.40, password is `raspberrypi`) and build the ROS2 workspace again. An example of how to do this is shown below:
|
||||||
```bash
|
```bash
|
||||||
# (On your computer) commit changes
|
# (On your computer) commit changes
|
||||||
git commit -a -m "Added new functionality"
|
git commit -a -m "Added new functionality"
|
||||||
git push
|
git push
|
||||||
# (On the flight computer) pull changes
|
# (On the flight computer) pull changes
|
||||||
ssh ubuntu@10.100.0.40
|
|
||||||
cd /home/ubuntu/ros2_ws
|
cd /home/ubuntu/ros2_ws
|
||||||
git fetch
|
git fetch
|
||||||
git pull
|
git pull
|
||||||
@@ -52,6 +55,24 @@ A pinout of the raspberry pi can be found [here](https://www.raspberrypi.com/doc
|
|||||||
|
|
||||||
## Connecting to API
|
## Connecting to API
|
||||||
To connect to the API, make sure you are connected to the 5G Hub network. Then, the API is located at http://10.1.1.41:8080/. When the drone is finished booting (the relais is switched on), you can connect to the drone using the `Connect` button.
|
To connect to the API, make sure you are connected to the 5G Hub network. Then, the API is located at http://10.1.1.41:8080/. When the drone is finished booting (the relais is switched on), you can connect to the drone using the `Connect` button.
|
||||||
|
|
||||||
|
## Installing API
|
||||||
|
To be able to run the API, npm and nodejs must be installed:
|
||||||
|
```bash
|
||||||
|
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
|
||||||
|
nvm install node
|
||||||
|
# to be able to run npm and nodejs as sudo, run the following commands:
|
||||||
|
n=$(which node)
|
||||||
|
n=${n%/bin/node}
|
||||||
|
chmod -R 755 $n/bin/*
|
||||||
|
sudo cp -r $n/{bin,lib,share} /usr/local
|
||||||
|
```
|
||||||
|
To install the API on a new edge computer, you must first clone this repository. Then you can run the NodeJS webserver using npm. You can do that using the following commands:
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/etmeddi/5g_drone_ROS2.git
|
||||||
|
cd 5g_drone_ROS2/api
|
||||||
|
npm start
|
||||||
|
```
|
||||||
## Installation on new flight computer
|
## Installation on new flight computer
|
||||||
The drone currently has a Raspberry Pi that contains a ROS2 installation. The Raspberry Pi runs Ubuntu 20.04 and ROS 2 Foxy. If you want to install this on a new Pi, you should [get Ubuntu Server 20.04](https://ubuntu.com/download/server#downloads), and [install ROS2 Foxy](https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Debians.html) on it. Then, you should clone this repository into a `ros2_ws` folder. You can do that using the following commands:
|
The drone currently has a Raspberry Pi that contains a ROS2 installation. The Raspberry Pi runs Ubuntu 20.04 and ROS 2 Foxy. If you want to install this on a new Pi, you should [get Ubuntu Server 20.04](https://ubuntu.com/download/server#downloads), and [install ROS2 Foxy](https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Debians.html) on it. Then, you should clone this repository into a `ros2_ws` folder. You can do that using the following commands:
|
||||||
```bash
|
```bash
|
||||||
@@ -72,9 +93,9 @@ git clone https://github.com/PX4/PX4-Autopilot.git --recursive
|
|||||||
In the PX4 directory, edit the file `src/modules/uxrce_dds_client/dds_topics.yaml`. Above the line that says `subscriptions:`, add the following:
|
In the PX4 directory, edit the file `src/modules/uxrce_dds_client/dds_topics.yaml`. Above the line that says `subscriptions:`, add the following:
|
||||||
```yaml
|
```yaml
|
||||||
- topic: /fmu/out/battery_status
|
- topic: /fmu/out/battery_status
|
||||||
type: px4_msgs::msg::battery_status
|
type: px4_msgs::msg::BatteryStatus
|
||||||
- topic: /fmu/out/cpuload
|
- topic: /fmu/out/cpuload
|
||||||
type: px4_msgs::msg::cpuload
|
type: px4_msgs::msg::Cpuload
|
||||||
```
|
```
|
||||||
The file can also be found in this repository at [dds_topics.yaml](dds_topics.yaml). After changing the file, you can build the firmware using the following command:
|
The file can also be found in this repository at [dds_topics.yaml](dds_topics.yaml). After changing the file, you can build the firmware using the following command:
|
||||||
```bash
|
```bash
|
||||||
@@ -96,7 +117,23 @@ To enable communication with the flight computer, the following parameters shoul
|
|||||||
|UXRCE_DDS_CFG|101|run microxrce-dds on TELEM 1|
|
|UXRCE_DDS_CFG|101|run microxrce-dds on TELEM 1|
|
||||||
|MAV_0_CONFIG|TELEM 4|run mavlink on TELEM 4 because XRCE-DDS runs on TELEM 1|
|
|MAV_0_CONFIG|TELEM 4|run mavlink on TELEM 4 because XRCE-DDS runs on TELEM 1|
|
||||||
|SER_TEL1_BAUD|921600|high baud rate because serial|
|
|SER_TEL1_BAUD|921600|high baud rate because serial|
|
||||||
|COM_RC_IN_MODE|4|allow arming without GPS|
|
|COM_RC_IN_MODE|4 (Stick input disabled)|allow arming without GPS|
|
||||||
|COM_RCL_EXCEPT|5|don't check for GPS|
|
|COM_RCL_EXCEPT|5|Ignore loss of RC remote signal|
|
||||||
|
|
||||||
|
## Optical flow
|
||||||
|
The optical flow sensor is a [Hex HereFlow PMW3901](https://docs.px4.io/main/en/sensor/pmw3901.html#hex-hereflow-pmw3901-optical-flow-sensor) and it's connected to the CAN port of the pixhawk. The parameters to enable the optical flow sensor are:
|
||||||
|
|Parameter|Value|Function|
|
||||||
|
|---|---|---|
|
||||||
|
|UAVCAN_ENABLE|2 (Sensors automatic config)|Enable UAVCAN for sensors|
|
||||||
|
|UAVCAN_SUB_FLOW|Enabled|subscribe to optical flow messages|
|
||||||
|
|UAVCAN_SUB_GPS|Disabled|subscribe to GPS messages|
|
||||||
|
|
||||||
|
To reverse this, and be able to use GPS, the parameters should be:
|
||||||
|
|
||||||
|
|Parameter|Value|Function|
|
||||||
|
|---|---|---|
|
||||||
|
|UAVCAN_ENABLE|0 (Disabled)|Enable UAVCAN for sensors|
|
||||||
|
|UAVCAN_SUB_FLOW|Disabled|subscribe to optical flow messages|
|
||||||
|
|UAVCAN_SUB_GPS|Enabled|subscribe to GPS messages|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user