Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port PX4 to BeagleBone Blue #9635

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
954c42c
Updated src/lib/DriverFramework
Bob-F May 27, 2018
1fdedcd
changes from git pull upstream master
UAV-Pilot May 31, 2018
4a90254
Firmware changes for porting PX4 to BeagleBone Blue board
UAV-Pilot May 31, 2018
72236b7
Merge branch 'master' of https://github.com/PX4/Firmware
UAV-Pilot Jun 10, 2018
a002bf1
Firmware changes for porting PX4 to BeagleBone Blue board
UAV-Pilot May 31, 2018
126a9e4
Revert "Updated src/lib/DriverFramework"
UAV-Pilot Jun 10, 2018
02697b5
skip output redirect when parsing arguments in main function
UAV-Pilot Jun 10, 2018
e47c9a4
resolve a conflict during git operations
UAV-Pilot Jun 10, 2018
eb2d15d
Added Robotics_Cape_Installer submodule
UAV-Pilot Jun 10, 2018
c98cc66
Merge branch 'master' of https://github.com/PX4/Firmware
UAV-Pilot Jun 13, 2018
0162b09
Merge branch 'master' of https://github.com/PX4/Firmware
UAV-Pilot Jun 13, 2018
a45ce46
Firmware changes for porting PX4 to BeagleBone Blue board
UAV-Pilot May 31, 2018
8dd5fbb
Revert "Updated src/lib/DriverFramework"
UAV-Pilot Jun 10, 2018
a95964a
skip output redirect when parsing arguments in main function
UAV-Pilot Jun 10, 2018
4134f72
Added Robotics_Cape_Installer submodule
UAV-Pilot Jun 10, 2018
6a03294
Firmware changes for porting PX4 to BeagleBone Blue board
UAV-Pilot May 31, 2018
a4b65a1
Modified per pull request comments: rolled back changes to px4_base.c…
UAV-Pilot Jun 13, 2018
1412c71
Resolve push conflict
UAV-Pilot Jun 13, 2018
19db523
Modified per pull request comments
UAV-Pilot Jun 13, 2018
2ad7fd9
sync change to src/lib/DriverFramework
UAV-Pilot Jun 13, 2018
5566ce5
Merge branch 'master' of https://github.com/PX4/Firmware
UAV-Pilot Jun 13, 2018
deb6d2d
Firmware changes for porting PX4 to BeagleBone Blue board
UAV-Pilot May 31, 2018
60ad621
Revert "Updated src/lib/DriverFramework"
UAV-Pilot Jun 10, 2018
54e1381
skip output redirect when parsing arguments in main function
UAV-Pilot Jun 10, 2018
09e750e
Added Robotics_Cape_Installer submodule
UAV-Pilot Jun 10, 2018
0817fd2
Firmware changes for porting PX4 to BeagleBone Blue board
UAV-Pilot May 31, 2018
acdc25e
skip output redirect when parsing arguments in main function
UAV-Pilot Jun 10, 2018
8bf145e
Firmware changes for porting PX4 to BeagleBone Blue board
UAV-Pilot May 31, 2018
d8e8914
Modified per pull request comments: rolled back changes to px4_base.c…
UAV-Pilot Jun 13, 2018
25a0b02
Modified per pull request comments
UAV-Pilot Jun 13, 2018
c10855e
git sync
UAV-Pilot Jun 13, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@
path = cmake/configs/uavcan_board_ident
url = https://github.com/PX4/uavcan_board_ident.git
branch = master
[submodule "src/lib/Robotics_Cape_Installer"]
path = src/lib/Robotics_Cape_Installer
url = https://github.com/StrawsonDesign/Robotics_Cape_Installer
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ add_subdirectory(msg EXCLUDE_FROM_ALL)

px4_generate_airframes_xml(BOARD ${BOARD})

add_subdirectory(src/lib/Robotics_Cape_Installer)

#=============================================================================
# DriverFramework
#
Expand Down
2 changes: 1 addition & 1 deletion Tools/sitl_gazebo
1 change: 0 additions & 1 deletion cmake/common/px4_base.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -632,4 +632,3 @@ function(px4_find_python_module module)
#message(FATAL_ERROR "python module not found, exiting")
#endif()
endfunction(px4_find_python_module)

105 changes: 105 additions & 0 deletions cmake/configs/posix_bbblue_common.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# This file is shared between posix_bbblue_native.cmake
# and posix_bbblue_cross.cmake.


# This definition allows to differentiate if this just the usual POSIX build
# or if it is for the bbblue.
add_definitions(
-D__PX4_POSIX_BBBLUE
-D__PX4_POSIX
-D__DF_LINUX # For DriverFramework
-D__DF_BBBLUE # For DriverFramework
# -D__RC_V0_3 # option for Robotics Cape v0.3
# -DDEBUG_BUILD
)

#optional __DF_BBBLUE_USE_RC_BMP280_IMP
add_definitions(
-D__DF_BBBLUE_USE_RC_BMP280_IMP
)

#optional __PX4_BBBLUE_DEFAULT_MAVLINK_WIFI, default is "SoftAp"
#add_definitions(
# -D__PX4_BBBLUE_DEFAULT_MAVLINK_WIFI="wlan"
#)


set(config_module_list
#
# Board support modules
#
#drivers/barometer
drivers/batt_smbus
drivers/differential_pressure
drivers/distance_sensor
#drivers/telemetry
#drivers/boards

modules/sensors

platforms/posix/drivers/df_mpu9250_wrapper
platforms/posix/drivers/df_bmp280_wrapper

#
# System commands
#
systemcmds/param
systemcmds/led_control
systemcmds/mixer
systemcmds/ver
systemcmds/esc_calib
systemcmds/reboot
systemcmds/topic_listener
systemcmds/tune_control
systemcmds/perf

#
# Estimation modules
#
modules/attitude_estimator_q
modules/position_estimator_inav
modules/local_position_estimator
modules/landing_target_estimator
modules/ekf2

#
# Vehicle Control
#
modules/fw_att_control
modules/fw_pos_control_l1
modules/gnd_att_control
modules/gnd_pos_control
modules/mc_att_control
modules/mc_pos_control
modules/vtol_att_control

#
# Library modules
#
modules/sdlog2
modules/logger
modules/commander
modules/dataman
modules/land_detector
modules/navigator
modules/mavlink

#
# PX4 drivers
#
drivers/linux_sbus
drivers/gps
drivers/bbblue_adc
drivers/linux_gpio
drivers/linux_pwm_out
drivers/pwm_out_sim

)

#
# DriverFramework driver
#
set(config_df_driver_list
mpu9250
bmp280
)
3 changes: 3 additions & 0 deletions cmake/configs/posix_bbblue_cross.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include(configs/posix_bbblue_common)

SET(CMAKE_TOOLCHAIN_FILE ${PX4_SOURCE_DIR}/cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake)
7 changes: 7 additions & 0 deletions cmake/configs/posix_bbblue_native.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include(configs/posix_bbblue_common)

add_definitions(
-D __DF_BBBLUE
)

set(CMAKE_TOOLCHAIN_FILE ${PX4_SOURCE_DIR}/cmake/toolchains/Toolchain-native.cmake)
18 changes: 18 additions & 0 deletions platforms/posix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,24 @@ if ("${BOARD}" STREQUAL "rpi")
USES_TERMINAL
)

elseif ("${BOARD}" STREQUAL "bbblue")
target_link_libraries(px4 PRIVATE robotics_cape)

add_custom_target(upload
COMMAND scp -r ${PX4_SOURCE_DIR}/posix-configs/bbblue/*.config debian@BBBluePX4:/home/debian/px4/posix-configs
COMMAND scp -r ${PX4_SOURCE_DIR}/ROMFS $<TARGET_FILE:px4> debian@BBBluePX4:/home/debian/px4
DEPENDS px4
COMMENT "uploading px4 and data files"
USES_TERMINAL
)

add_custom_target(upload_px4
COMMAND scp -r $<TARGET_FILE:px4> debian@BBBluePX4:/home/debian/px4
DEPENDS px4
COMMENT "uploading px4"
USES_TERMINAL
)

elseif ("${BOARD}" STREQUAL "bebop")

add_custom_target(upload
Expand Down
7 changes: 6 additions & 1 deletion platforms/posix/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,10 @@ int main(int argc, char **argv)
string data_path;
string node_name;

bool skippingOutputRedirect = false;

// parse arguments
while (index < argc) {
while (index < argc && !skippingOutputRedirect) {
//cout << "arg: " << index << " : " << argv[index] << endl;

if (argv[index][0] == '-') {
Expand Down Expand Up @@ -366,6 +368,9 @@ int main(int argc, char **argv)
cout << "node name: " << node_name << endl;
}

} else if (strchr(argv[index], '>')) {
skippingOutputRedirect = true;

} else {
//cout << "positional argument" << endl;

Expand Down
92 changes: 92 additions & 0 deletions posix-configs/bbblue/px4.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# config for a quad
# modified from ../rpi/px4.config

uorb start
param load

# Auto-start script index. Defines the auto-start script used to bootstrap the system.
# It seems that SYS_AUTOSTART does not work as intended on posix platform.
# For now, find the corresponding settings, and manually set them in ground control.
#
# 4001: Generic Quadrotor X; 4011: DJI Flame Wheel F450
param set SYS_AUTOSTART 4011

# DJI ESCs do not support calibration and need higher PWM_MIN
# http://www.dji.com/e2000/info indicates E2000 Operating Pulse Width: 1120 to 1920 μs
# It seems that all latest DJI ESC have the same range.
# Note that the setting here applies to all PWM channels.
# param set PWM_MIN 1120
# param set PWM_MAX 1920
# Not using DJI 430 LITE ESC anymore due to its hiccups:
# each random motor stop would cause a scary flip in the fly
# Replacing with 4 BLHeli32 (Wraith32 V2) ESCs solved the main problem in BBBlue porting

# Broadcast heartbeats on local network. This allows a ground control station
# to automatically find the drone on the local network.
param set MAV_BROADCAST 1

# MAV_TYPE: 1 Fixed wing aircraft, 2 Quadrotor
param set MAV_TYPE 2

# Set multicopter estimator group, 1 local_position_estimator, attitude_estimator_q, 2 ekf2
param set SYS_MC_EST_GROUP 2

# Three possible main power battery sources for BBBlue:
# 1. onboard 2S LiPo battery connector, which is connect to ADC channel 6
# 2. onboard 9-18V DC Jack, which is connect to ADC channel 5. This is the board default.
# 3. other power source (e.g., LiPo battery more than 4S/18V).
# Scale the voltage to below 1.8V and connect it to ADC channel # 0, 1, 2 or 3.
param set BAT_ADC_CHANNEL 5

# 12-bit 1.8V ADC, 1.8V / 2^12 = 0.000439453125 V/CNT
param set BAT_CNT_V_VOLT 0.0004394531

# Battery voltage scale factor, from BBBlue schematics: (4.7K + 47K) / 4.7K = 11
param set BAT_V_DIV 11.0

#param set BAT_CNT_V_CURR 0.001
#param set BAT_A_PER_V 15.391030303

dataman start

df_bmp280_wrapper start -D /dev/i2c-2

df_mpu9250_wrapper start
# options: -R rotation

gps start -d /dev/ttyS2 -s -p ubx

#rgbled start -b 1
bbblue_adc start
bbblue_adc test

sensors start
commander start
navigator start
ekf2 start
#land_detector start multicopter

mc_pos_control start
mc_att_control start
#fw_att_control start
#fw_pos_control_l1 start

mavlink start -x -u 14556 -r 1000000
# -n name of wifi interface: SoftAp, wlan or your custom interface,
# e.g., -n wlan . The default on BBBlue is SoftAp

sleep 1

mavlink stream -u 14556 -s HIGHRES_IMU -r 20
mavlink stream -u 14556 -s ATTITUDE -r 20
mavlink stream -u 14556 -s MANUAL_CONTROL -r 10

linux_sbus start -d /dev/ttyS4 -c 16
# DSM2 port is mapped to /dev/ttyS4 (default for linux_sbus)

# default: ROMFS/px4fmu_common/mixers/quad_x.main.mix, 8 output channels
linux_pwm_out start -p bbblue_rc -m ROMFS/px4fmu_common/mixers/quad_x.main.mix
#linux_pwm_out start -p bbblue_rc -m ROMFS/px4fmu_common/mixers/AETRFG.main.mix

logger start -t -b 200
mavlink boot_complete
92 changes: 92 additions & 0 deletions posix-configs/bbblue/px4_fw.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# config for fixed wing (FW)
# modified from ./px4.config, switch att/pos_control & mixer

uorb start
param load

# Auto-start script index. Defines the auto-start script used to bootstrap the system.
# It seems that SYS_AUTOSTART does not work as intended on posix platform.
# For now, find the corresponding settings, and manually set them in ground control.
#
# 4001: Generic Quadrotor X; 4011: DJI Flame Wheel F450
param set SYS_AUTOSTART 4011

# DJI ESCs do not support calibration and need higher PWM_MIN
# http://www.dji.com/e2000/info indicates E2000 Operating Pulse Width: 1120 to 1920 μs
# It seems that all latest DJI ESC have the same range.
# Note that the setting here applies to all PWM channels.
# param set PWM_MIN 1120
# param set PWM_MAX 1920
# Not using DJI 430 LITE ESC anymore due to its hiccups:
# each random motor stop would cause a scary flip in the fly
# Replacing with 4 BLHeli32 (Wraith32 V2) ESCs solved the main problem in BBBlue porting

# Broadcast heartbeats on local network. This allows a ground control station
# to automatically find the drone on the local network.
param set MAV_BROADCAST 1

# MAV_TYPE: 1 Fixed wing aircraft, 2 Quadrotor
param set MAV_TYPE 2

# Set multicopter estimator group, 1 local_position_estimator, attitude_estimator_q, 2 ekf2
param set SYS_MC_EST_GROUP 2

# Three possible main power battery sources for BBBlue:
# 1. onboard 2S LiPo battery connector, which is connect to ADC channel 6
# 2. onboard 9-18V DC Jack, which is connect to ADC channel 5. This is the board default.
# 3. other power source (e.g., LiPo battery more than 4S/18V).
# Scale the voltage to below 1.8V and connect it to ADC channel # 0, 1, 2 or 3.
param set BAT_ADC_CHANNEL 5

# 12-bit 1.8V ADC, 1.8V / 2^12 = 0.000439453125 V/CNT
param set BAT_CNT_V_VOLT 0.0004394531

# Battery voltage scale factor, from BBBlue schematics: (4.7K + 47K) / 4.7K = 11
param set BAT_V_DIV 11.0

#param set BAT_CNT_V_CURR 0.001
#param set BAT_A_PER_V 15.391030303

dataman start

df_bmp280_wrapper start -D /dev/i2c-2

df_mpu9250_wrapper start
# options: -R rotation

gps start -d /dev/ttyS2 -s -p ubx

#rgbled start -b 1
bbblue_adc start
bbblue_adc test

sensors start
commander start
navigator start
ekf2 start
#land_detector start multicopter

#mc_pos_control start
#mc_att_control start
fw_att_control start
fw_pos_control_l1 start

mavlink start -x -u 14556 -r 1000000
# -n name of wifi interface: SoftAp, wlan or your custom interface,
# e.g., -n wlan . The default on BBBlue is SoftAp

sleep 1

mavlink stream -u 14556 -s HIGHRES_IMU -r 20
mavlink stream -u 14556 -s ATTITUDE -r 20
mavlink stream -u 14556 -s MANUAL_CONTROL -r 10

linux_sbus start -d /dev/ttyS4 -c 16
# DSM2 port is mapped to /dev/ttyS4 (default for linux_sbus)

# default: ROMFS/px4fmu_common/mixers/quad_x.main.mix, 8 output channels
#linux_pwm_out start -p bbblue_rc -m ROMFS/px4fmu_common/mixers/quad_x.main.mix
linux_pwm_out start -p bbblue_rc -m ROMFS/px4fmu_common/mixers/AETRFG.main.mix

logger start -t -b 200
mavlink boot_complete
Loading