Skip to content

Commit

Permalink
VOXL2 board support updates (PX4#21426)
Browse files Browse the repository at this point in the history
  • Loading branch information
katzfey authored Apr 19, 2023
1 parent cb66c48 commit 018ca6b
Show file tree
Hide file tree
Showing 17 changed files with 745 additions and 131 deletions.
32 changes: 21 additions & 11 deletions boards/modalai/voxl2-slpi/default.px4board
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
CONFIG_PLATFORM_QURT=y
CONFIG_BOARD_TOOLCHAIN="qurt"
CONFIG_DRIVERS_ACTUATORS_MODAL_IO=y
CONFIG_DRIVERS_LIGHTS_RGBLED_NCP5623C=y
CONFIG_BOARD_ROOTFSDIR="/"
CONFIG_MODULES_MUORB_SLPI=y
CONFIG_SYSTEMCMDS_UORB=y
CONFIG_ORB_COMMUNICATOR=y
CONFIG_DRIVERS_POWER_MONITOR_VOXLPM=y
CONFIG_DRIVERS_QSHELL_QURT=y
CONFIG_MODULES_COMMANDER=y
CONFIG_DRIVERS_ACTUATORS_MODAL_IO=y
CONFIG_DRIVERS_BAROMETER_INVENSENSE_ICP101XX=y
CONFIG_DRIVERS_LIGHTS_RGBLED_NCP5623C=y
CONFIG_DRIVERS_MAGNETOMETER_ISENTEK_IST8310=y
CONFIG_DRIVERS_MAGNETOMETER_QMC5883L=y
CONFIG_DRIVERS_GPS=y
CONFIG_DRIVERS_RC_CRSF_RC=y
CONFIG_MODULES_MANUAL_CONTROL=y
CONFIG_MODULES_CONTROL_ALLOCATOR=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_EKF2=y
CONFIG_MODULES_LAND_DETECTOR=y
CONFIG_MODULES_MC_ATT_CONTROL=y
CONFIG_MODULES_MC_HOVER_THRUST_ESTIMATOR=y
CONFIG_MODULES_MC_POS_CONTROL=y
CONFIG_MODULES_MC_ATT_CONTROL=y
CONFIG_MODULES_MC_RATE_CONTROL=y
CONFIG_MODULES_MUORB_SLPI=y
CONFIG_MODULES_SENSORS=y
CONFIG_SYSTEMCMDS_PARAM=y
CONFIG_SYSTEMCMDS_UORB=y
CONFIG_ORB_COMMUNICATOR=y
CONFIG_MODULES_MC_HOVER_THRUST_ESTIMATOR=y
CONFIG_MODULES_MC_AUTOTUNE_ATTITUDE_CONTROL=y
CONFIG_MODULES_LAND_DETECTOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_COMMANDER=y
CONFIG_PARAM_CLIENT=y
2 changes: 1 addition & 1 deletion boards/modalai/voxl2-slpi/src/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
* I2C buses
*/
#define CONFIG_I2C 1
#define PX4_NUMBER_I2C_BUSES 3
#define PX4_NUMBER_I2C_BUSES 4

/*
* SPI buses
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <uORB/Publication.hpp>
#include <uORB/PublicationMulti.hpp>
#include <uORB/topics/input_rc.h>
#include <uORB/topics/radio_status.h>
#include "uORB/uORBManager.hpp"
#include <mavlink.h>
#include <px4_log.h>
Expand Down Expand Up @@ -77,6 +78,7 @@ std::string port = "7";
uint32_t baudrate = 115200;

uORB::PublicationMulti<input_rc_s> _rc_pub{ORB_ID(input_rc)};
uORB::PublicationMulti<radio_status_s> _radio_status_pub{ORB_ID(radio_status)};

perf_counter_t _perf_rx_rate = nullptr;

Expand All @@ -97,6 +99,7 @@ void task_main(int argc, char *argv[]);

void handle_message_dsp(mavlink_message_t *msg);
void handle_message_rc_channels_override_dsp(mavlink_message_t *msg);
void handle_message_radio_status_dsp(mavlink_message_t *msg);

void handle_message_dsp(mavlink_message_t *msg)
{
Expand All @@ -117,6 +120,10 @@ void handle_message_dsp(mavlink_message_t *msg)
handle_message_rc_channels_override_dsp(msg);
break;

case MAVLINK_MSG_ID_RADIO_STATUS:
handle_message_radio_status_dsp(msg);
break;

default:
break;
}
Expand Down Expand Up @@ -300,12 +307,33 @@ void task_main(int argc, char *argv[])
}
}

void handle_message_radio_status_dsp(mavlink_message_t *msg)
{
if (debug) { PX4_INFO("Radio status msg received"); }

mavlink_radio_status_t rstatus;
mavlink_msg_radio_status_decode(msg, &rstatus);

radio_status_s status{};

status.timestamp = hrt_absolute_time();
status.rssi = rstatus.rssi;
status.remote_rssi = rstatus.remrssi;
status.txbuf = rstatus.txbuf;
status.noise = rstatus.noise;
status.remote_noise = rstatus.remnoise;
status.rxerrors = rstatus.rxerrors;
status.fix = rstatus.fixed;

_radio_status_pub.publish(status);
}

void handle_message_rc_channels_override_dsp(mavlink_message_t *msg)
{
mavlink_rc_channels_override_t man;
mavlink_msg_rc_channels_override_decode(msg, &man);

// if (debug) PX4_INFO("RC channels override msg received");
if (debug) { PX4_INFO("RC channels override msg received"); }

// Check target
if (man.target_system != 0) {
Expand Down
1 change: 1 addition & 0 deletions boards/modalai/voxl2-slpi/src/i2c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@
constexpr px4_i2c_bus_t px4_i2c_buses[I2C_BUS_MAX_BUS_ITEMS] = {
initI2CBusExternal(1),
initI2CBusExternal(2),
initI2CBusExternal(4),
initI2CBusInternal(5)
};
28 changes: 17 additions & 11 deletions boards/modalai/voxl2/default.px4board
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,25 @@ CONFIG_PLATFORM_POSIX=y
CONFIG_BOARD_LINUX_TARGET=y
CONFIG_BOARD_TOOLCHAIN="aarch64-linux-gnu"
CONFIG_BOARD_ROOTFSDIR="/data/px4"
CONFIG_ORB_COMMUNICATOR=y
CONFIG_PARAM_SERVER=y
CONFIG_DRIVERS_QSHELL_POSIX=y
CONFIG_MODULES_COMMANDER=y
CONFIG_DRIVERS_OSD_MSP_OSD=y
CONFIG_DRIVERS_ACTUATORS_MODAL_IO=y
CONFIG_SYSTEMCMDS_PERF=y
CONFIG_SYSTEMCMDS_UORB=y
CONFIG_SYSTEMCMDS_PARAM=y
CONFIG_SYSTEMCMDS_TOPIC_LISTENER=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_VER=y
CONFIG_MODULES_LOGGER=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_DATAMAN=y
CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_COMMANDER=y
CONFIG_MODULES_FLIGHT_MODE_MANAGER=y
CONFIG_MODULES_LOGGER=y
CONFIG_MODULES_MAVLINK=y
CONFIG_MODULES_CONTROL_ALLOCATOR=y
CONFIG_MODULES_MUORB_APPS=y
CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_PARAM=y
CONFIG_SYSTEMCMDS_PERF=y
CONFIG_SYSTEMCMDS_TOPIC_LISTENER=y
CONFIG_SYSTEMCMDS_UORB=y
CONFIG_SYSTEMCMDS_VER=y
CONFIG_ORB_COMMUNICATOR=y

116 changes: 115 additions & 1 deletion boards/modalai/voxl2/scripts/install-voxl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,125 @@ adb push build/modalai_voxl2_default/bin/px4 /usr/bin
# Push scripts to voxl2
adb push build/modalai_voxl2_default/bin/px4-alias.sh /usr/bin
adb push boards/modalai/voxl2/target/voxl-px4 /usr/bin
adb push boards/modalai/voxl2/target/voxl-px4-start /usr/bin
adb shell chmod a+x /usr/bin/px4-alias.sh
adb shell chmod a+x /usr/bin/voxl-px4
adb shell chmod a+x /usr/bin/voxl-px4-start

# Push configuration file
adb shell mkdir -p /etc/modalai
adb push boards/modalai/voxl2/target/voxl-px4.config /etc/modalai
adb push boards/modalai/voxl2/target/voxl-px4-set-default-parameters.config /etc/modalai
adb push boards/modalai/voxl2/target/voxl-px4-fake-imu-calibration.config /etc/modalai

# Make sure to setup all of the needed px4 aliases.
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-accelsim"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-attitude_estimator_q"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-barosim"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-batt_smbus"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-bottle_drop"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-camera_feedback"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-camera_trigger"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-cdev_test"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-cm8jl65"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-commander"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-commander_tests"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-control_allocator"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-controllib_test"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-dataman"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-ekf2"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-esc_calib"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-ets_airspeed"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-ex_fixedwing_control"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-fw_att_control"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-fw_pos_control_l1"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-gnd_att_control"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-gnd_pos_control"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-gps"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-gpssim"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-gyrosim"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-hello"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-hrt_test"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-land_detector"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-landing_target_estimator"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-led_control"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-leddar_one"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-linux_sbus"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-listener"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-ll40ls"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-load_mon"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-local_position_estimator"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-logger"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-manual_control"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-mavlink"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-mavlink_bridge"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-mavlink_tests"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-mb12xx"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-mc_att_control"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-mc_pos_control"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-measairspeedsim"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-mixer"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-motor_ramp"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-modalai_gps_timer"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-ms4525_airspeed"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-ms5525_airspeed"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-msp_osd"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-muorb"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-muorb_test"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-navigator"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-param"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-perf"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-pga460"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-position_estimator_inav"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-pwm"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-pwm_out_sim"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-px4io"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-px4_mavlink_debug"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-px4_simple_app"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-qshell"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-rc_tests"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-rc_update"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-reboot"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-rgbled"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-rover_steering_control"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-sd_bench"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-sdp3x_airspeed"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-segway"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-send_event"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-sensors"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-sf0x"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-sf0x_tests"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-sf1xx"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-shutdown"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-sih"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-simulator"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-spektrum_rc"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-srf02"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-teraranger"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-tests"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-tfmini"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-top"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-tune_control"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-ulanding_radar"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-uorb"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-uorb_tests"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-ver"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-vl53lxx"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-vmount"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-vtol_att_control"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-wind_estimator"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-rc_controller"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-uart_esc_driver"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-flight_mode_manager"
adb shell "cd /usr/bin; /bin/ln -f -s px4 px4-imu_server"

# Make sure any required directories exist
adb shell "/bin/mkdir -p /data/px4/param"
adb shell "/bin/mkdir -p /data/px4/etc/extras"

# Push the json files for the component metadata
adb push build/modalai_voxl2_default/actuators.json.xz /data/px4/etc/extras
adb push build/modalai_voxl2_default/component_general.json.xz /data/px4/etc/extras
adb push build/modalai_voxl2_default/parameters.json.xz /data/px4/etc/extras
adb push build/modalai_voxl2_default/events/all_events.json.xz /data/px4/etc/extras

adb shell sync
2 changes: 2 additions & 0 deletions boards/modalai/voxl2/src/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,5 @@

#define BOARD_OVERRIDE_UUID "MODALAIVOXL20000" // must be of length 16
#define PX4_SOC_ARCH_ID PX4_SOC_ARCH_ID_VOXL2

#define MODAL_IO_DEFAULT_PORT "2"
Loading

0 comments on commit 018ca6b

Please sign in to comment.