NavQ is described on Gitbook - https://nxp.gitbook.io/8mmnavq/
***DRAFT*** This is a work in progress and may have errors.
This page holds suggestions for general settings of navq.
**** NOTE your hardware configuration may differ from the instructions here. Please post a reply where you find issues and we'll update.
**** These instructions are for a setup that includes MAVLINK over an Ethernet Connection between the NavQ and the RDDRONEFMUK66. Unfortunately you will not have the RJ45 to 2-wire ethernet adapter that is needed. Modifications will be needed to make this work with UART based communications
[Credits - Gerald Peklar, Peter Van Der Perk]
**** NOTE your hardware configuration may differ from the instructions here. Please post a reply where you find issues and we'll update.
**** These instructions are for a setup that includes MAVLINK over an Ethernet Connection between the NavQ and the RDDRONEFMUK66. Unfortunately you will not have the RJ45 to 2-wire ethernet adapter that is needed. Modifications will be needed to make this work with UART based communications
[Credits - Gerald Peklar, Peter Van Der Perk]
Documentation below assumes internet access of navq via wifi. Guide on how to enable wifi is available on navq gitbook - https://nxp.gitbook.io/8mmnavq/getting-started/quickstart#connecting-to-wifi
The editor nano is helpful. Install nano with (internet access required).
~$ sudo apt install nano
Since several NavQs might be present in a Wifi Network it's desired to set an unique hostname to determine the "right" navq to connect to.
Modify /etc/hostname with a unique host name. Proposal is to use
navq-[Vehicle Mavlink SysID]
e.g. if Mavlink SysID is 10 the navq should be named navq-10
~$ sudo nano /etc/hostname
navq-10
Since there is no DHCP on a drone and FMUK66 has a fixed IP of 10.0.0.2 we need to set a fixed IP for eth0 to be able to communicate via ethernet to FMUK66.
Suggestion is to use 10.0.0.3 for navq. 10.0.0.1 is reserved for the D2X gen1 board acting as a network switch.
connman is used for setting the network . To force connman to use a fixed IP in case of no DHCP is available the following file needs to be created.
~$ sudo nano /var/lib/connman/ethernet.config
[global] Name = Ethernet_config Description = Ethernet fixed IP setting [service_onboard_ethernet] Type = ethernet IPv4 = 10.0.0.3/255.255.255.0/10.0.0.1
The IP4 settings are ownIP/netmask/router. 10.0.0.1 is set assuming a D2X board is in place.
Connecting navq to FMUK66 requires a T1 media converter - https://nxp.gitbook.io/8mmnavq/navq-add-on-modules/100baset1-2-wire-automotive-ethernet-media-conver...
T1 ethernet is supported by PX4 on FMUK66 with latest master.
To enable FMUK66 sending mavlink telemetry via UDP to a specific IP is done by setting up the following file on the FMUK66 SDcard.
/etc/extras.txt
mavlink start -x -u 14551 -o 14551 -r 200000 -t 10.0.0.3 -m onboard
10.0.0.3 is the IP address of navq on the vehicle.
Description of the mavlink start parameters on https://dev.px4.io/v1.9.0/en/middleware/modules_communication.html
Additionally the MAV_BROADCAST parameter on the FMU needs to be set to 2 - only multicast.
To be able to have several end nodes communicating via mavlink we need to set up mavlink-router on the navq.
End nodes can be
- a process for onboard control running on navq.
- a QGC computer the navq connects to via wifi.
- other mavlink enabled peripherals on the vehicle.
Compile and installation of mavlink router is done with the following steps on the navq (internet access required):
~$ mkdir src ~$ cd src ~/src$ git clone https://github.com/intel/mavlink-router.git ~/src$ cd mavlink-router ~/src/mavlink-router$ git submodule update --init --recursive ~/src/mavlink-router$ ./autogen.sh && ./configure CFLAGS='-g -O2' --sysconfdir=/etc --localstatedir=/var --libdir=/usr/lib --prefix=/usr ~/src/mavlink-router$ make ~/src/mavlink-router$ sudo make install
Configuration of mavlink router is done via a single configuration file expected as /etc/mavlink-router/main.conf
This file needs to be created from scratch. Example configuration file - https://github.com/intel/mavlink-router/blob/master/examples/config.sample
Setup the config file with minimal configuration
~$ sudo nano /etc/mavlink-router/main.conf
#Mavlink router configuration navq # [General] TcpServerPort=5790 ReportStats=false MavlinkDialect=auto [UartEndpoint FMUuart] Device=/dev/ttymxc2 Baud=155200 [UdpEndpoint FMUeth] Mode = Eavesdropping Address = 0.0.0.0 Port = 14551 [UdpEndpoint QGConMobile] Mode = Normal Address = 192.168.43.1 Port = 14550
The configuration above assumes that the navq gets mavlink data from FMU either via UART3 (/dev/ttymxc2) or UDP.
You can leave out the unused connection.
Via the UdpEndpoint QGConMobile section the mavlink stream is forwarded to a QGC computer/mobile device assuming it has 192.168.43.1 and navq is connected to this network via e.g. wifi.
Enable the autostart of mavlink-router via systemd and start it
~$ sudo systemctl enable mavlink-router
~$ sudo systemctl start mavlink-router
Finally you can check the status of mavlink router via
~$ sudo systemctl status mavlink-router
Good source for how-to do locale setting is https://help.ubuntu.com/community/Locale#List_current_settings
Example settings for Germany
First generate the German locales
sudo locale-gen de_DE.UTF-8
Set the German locales but have messages in english still. This is defined by LC_MESSAGES setting.
sudo update-locale LANG=de_DE.UTF-8 sudo update-locale LC_MESSAGES=POSIX
-
- Update PX4 build environment to latest status and build the code with
make nxp_fmuk66-v3_rtps - upload the generated nxp_fmuk66-v3_rtps FW into FMUK66.
- Prepare the FMU's SD card by adjusting /etc/extras.txt file.
This will autostart the fastRTPS communication at boot time.
Add the following line in to /etc/extras.txt
micrortps_client start -t UDP -i 10.0.0.3
Assuming that NavQ is running with IP 10.0.0.3
All commands to be executed on NavQ
Install ROS2 foxy using
NavQ
K66
Follow the guide on https://index.ros.org/doc/ros2/Installation/Foxy/Linux-Install-Debians/#setup-sources
Note (1): at Setup Sources step you might get an error message by curl
To avoid this do upfront
sudo rm -rf /usr/lib/libcurl* sudo apt install curl
Note (2): at Install ROS2 package step use
sudo apt install ros-foxy-ros-base
Desktop is not needed on a headless system!
System requirements
~$ sudo apt update ~$ sudo apt install cmake python3-pip gradle python3-colcon-common-extensions gradle ~$ pip3 install --user pyros-genmsg
Setting up PX4 Ros com for ROS2 Foxy
If you have no src directory yet on NavQ's home directory just create it
~$ mkdir src
~$ cd src
~/src$ git clone --recursive https://github.com/eProsima/Fast-RTPS.git -b 1.8.x FastRTPS-1.8.2
~/src$ cd FastRTPS-1.8.2
~/src/FastRTPS-1.8.2$ mkdir build
~/src/FastRTPS-1.8.2$ cd build
~/src/FastRTPS-1.8.2/build$ cmake -DTHIRDPARTY=ON -DSECURITY=ON ..
~/src/FastRTPS-1.8.2/build$ make
~/src/FastRTPS-1.8.2/build$ sudo make install
cd ~/src
~/src$ git clone --recursive https://github.com/eProsima/Fast-RTPS-Gen.git -b v1.0.4 Fast-RTPS-Gen
~/src$ cd Fast-RTPS-Gen
~/src/Fast-RTPS-Gen$ unset TERM
~/src/Fast-RTPS-Gen$ ./gradlew assemble
~/src/Fast-RTPS-Gen$ sudo su
~/src/Fast-RTPS-Gen# unset TERM
~/src/Fast-RTPS-Gen# ./gradlew install
~/src/Fast-RTPS-Gen# exit
~/src/Fast-RTPS-Gen$
cd ~/ mkdir -p ~/px4_ros_com_ros2/src git clone https://github.com/PX4/px4_ros_com.git ~/px4_ros_com_ros2/src/px4_ros_com git clone https://github.com/PX4/px4_msgs.git ~/px4_ros_com_ros2/src/px4_msgs
# Note building px4_ros_com requires a lot of ram, enable a swap disk is recommended
Execute building PX4 ROS2
~$ ./px4_ros_com_ros2/src/px4_ros_com/scripts/build_ros2_workspace.bash
Starting MicroRTPS bridge Prerequisit - Ethernet configuration
-NavQ 10.0.0.3/24
-K66 10.0.0.2/24
See also Setting a fixed IP to use eth for FMU communication in Wiki and Setting up FMUK66 for mavlink over T1 ethernet in Wiki
~$ source /opt/ros/foxy/setup.bash ~$ source ~/px4_ros_com_ros2/install/setup.bash ~$ micrortps_agent -t UDP -i 10.0.0.2
see Setting up FMUK66 for fastRTPS in Wiki
Optional debugging
source /opt/ros/foxy/setup.bash source ~/px4_ros_com_ros2/install/setup.bash sudo apt install ros-foxy-rqt-topic rqt_topic --force-discover
The instruction below assumes that you have successfully executed Setting up ROS2 on NavQ in Wiki
Generate a start up script for the micrortps client under /usr/local/bin
sudo nano /usr/local/bin/start_micrortps_agent.sh
with content
#!/bin/bash ## startup script for micro_rtps_agent ## agent will communicate to FMUK66 via UDP ## FMUK66 IPv4 addr = 10.0.0.2 ## ## Author: Gerald Peklar <gerald.peklar@nxp.com>
source /opt/ros/foxy/setup.bash source ~/px4_ros_com_ros2/install/setup.bash
micrortps_agent -t UDP -i 10.0.0.2
Save the file and exit nano.
Make the file executable
sudo chmod +x /usr/local/bin/start_micrortps_agent.sh
Generate a systemd service file to start the startup script at boot
sudo nano /etc/systemd/system/micrortps_agent.service
with content
[Unit] Description=PX4 micrortps service After=network.target [Service] Restart=always TimeoutStartSec=10 User=navq Group=navq WorkingDirectory=~ ExecStart=/usr/local/bin/start_micrortps_agent.sh [Install] WantedBy=multi-user.target
Save the file and exit nano.
Check if the process starts
sudo systemctl start micrortps_agent.service sudo systemctl status micrortps_agent.service
You should see an state active (running)
quit with <q>
Enable the systemd service file finally to be active at boot
sudo systemctl enable micrortps_agent.service