Compare commits

..

1 Commits

Author SHA1 Message Date
Alexander Lerach 9b55dc81ca bl_update: Allow booting from SD card (without forced BL copy to ROMFS) 2025-08-20 18:22:42 +02:00
237 changed files with 1754 additions and 7744 deletions
-5
View File
@@ -36,11 +36,6 @@ CONFIG:
buildType: RelWithDebInfo
settings:
CONFIG: px4_sitl_test
px4_sitl_zenoh:
short: px4_sitl_zenoh
buildType: RelWithDebInfo
settings:
CONFIG: px4_sitl_test
px4_io-v2_default:
short: px4_io-v2
buildType: MinSizeRel
-5
View File
@@ -73,11 +73,6 @@ menu "Toolchain"
help
relative path to the ROMFS root directory
config BOARD_ADDITIONAL_INIT
string "Additional init file"
help
additional configurable init file to include in the ROMFS
config BOARD_IO
string "IO board name"
default "px4_io-v2_default"
+1 -1
View File
@@ -19,7 +19,7 @@ See [the documentation on Maintainers](https://docs.px4.io/main/en/contribute/ma
| Matthias Grob | Multirotor | [@MaEtUgR](https://github.com/MaEtUgR) | maetugr |
| Silvan Fuhrer | Fixed-Wing / VTOL | [@sfuhrer](https://github.com/sfuhrer) | sfuhrer |
| Christian Friedrich | Rover | [@chfriedrich98](https://github.com/chfriedrich98) | christian982564 |
| Pedro Roque | Spacecraft | [@Pedro-Roque](https://github.com/Pedro-Roque) | .pedroroque | <roque@caltech.edu>
| Pedro Roque | Spacecraft | [@Pedro-Roque](https://github.com/Pedro-Roque) | .pedroroque | <padr@kth.se>
| Jacob Dahl | Simulation | [@dakejahl](https://github.com/dakejahl) | dakejahl | <dahl.jakejacob@gmail.com>
-1
View File
@@ -511,7 +511,6 @@ validate_module_configs:
@find "$(SRC_DIR)"/src/modules "$(SRC_DIR)"/src/drivers "$(SRC_DIR)"/src/lib -name *.yaml -type f \
-not -path "$(SRC_DIR)/src/lib/mixer_module/*" \
-not -path "$(SRC_DIR)/src/modules/uxrce_dds_client/dds_topics.yaml" \
-not -path "$(SRC_DIR)/src/modules/zenoh/dds_topics.yaml" \
-not -path "$(SRC_DIR)/src/modules/zenoh/zenoh-pico/*" \
-not -path "$(SRC_DIR)/src/lib/events/libevents/*" \
-not -path "$(SRC_DIR)/src/lib/cdrstream/*" \
+2 -27
View File
@@ -202,43 +202,18 @@ foreach(board_rc_file ${OPTIONAL_BOARD_RC})
endforeach()
if(config_additional_init)
if(EXISTS "${PX4_BOARD_DIR}/init/${config_additional_init}")
file(RELATIVE_PATH rc_file_relative ${PX4_SOURCE_DIR} ${PX4_BOARD_DIR}/init/${config_additional_init})
message(STATUS "ROMFS: Adding ${rc_file_relative} -> /etc/init.d/rc.additional_init")
add_custom_command(
OUTPUT
${romfs_gen_root_dir}/init.d/rc.additional_init
${config_additional_init}.stamp
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${PX4_BOARD_DIR}/init/${config_additional_init} ${romfs_gen_root_dir}/init.d/rc.additional_init
COMMAND ${CMAKE_COMMAND} -E touch ${config_additional_init}.stamp
DEPENDS
${PX4_BOARD_DIR}/init/${config_additional_init}
romfs_copy.stamp
COMMENT "ROMFS: copying ${config_additional_init}"
)
list(APPEND extras_dependencies
${config_additional_init}.stamp
)
else()
message(FATAL_ERROR "BOARD_ADDITIONAL_INIT file not found at: ${PX4_BOARD_DIR}/init/${config_additional_init}")
endif()
endif()
# board extras
set(OPTIONAL_BOARD_EXTRAS)
file(GLOB OPTIONAL_BOARD_EXTRAS ${PX4_BOARD_DIR}/extras/*)
# bootloader (optional)
# - if systemcmds/bl_update included and board bootloader available then generate rc.board_bootloader_upgrade and copy bootloader binary
# - if systemcmds/bl_update included (with romfs copy) and board bootloader available then generate rc.board_bootloader_upgrade and copy bootloader binary
# - otherwise remove bootloader binary from extras in final ROMFS
foreach(board_extra_file ${OPTIONAL_BOARD_EXTRAS})
file(RELATIVE_PATH extra_file_base_name ${PX4_BOARD_DIR}/extras/ ${board_extra_file})
if(${extra_file_base_name} MATCHES "${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL}_bootloader.bin")
if(CONFIG_SYSTEMCMDS_BL_UPDATE)
if(CONFIG_SYSTEMCMDS_BL_UPDATE AND CONFIG_BL_UPDATE_BL_ROMFS)
# generate rc.board_bootloader_upgrade
set(BOARD_FIRMWARE_BIN "${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL}_bootloader.bin")
message(STATUS "ROMFS: Adding platforms/nuttx/init/rc.board_bootloader_upgrade -> /etc/init.d/rc.board_bootloader_upgrade")
-11
View File
@@ -56,17 +56,6 @@ then
fi
unset BOARD_RC_DEFAULTS
#
# Optional additional init file: rc.additional_init
#
set BOARD_RC_ADDITIONAL_INIT ${R}etc/init.d/rc.additional_init
if [ -f $BOARD_RC_ADDITIONAL_INIT ]
then
echo "Board additional init: ${BOARD_RC_ADDITIONAL_INIT}"
. $BOARD_RC_ADDITIONAL_INIT
fi
unset BOARD_RC_ADDITIONAL_INIT
#
# Start system state indicator.
#
@@ -1,21 +1,10 @@
#!/bin/sh
#
# @name KTH-ATMOS
# @name 3DoF Spacecraft Model
#
# @type Free-Flyer
# @class Spacecraft
# @type 2D Freeflyer with 8 thrusters - Planar motion
#
# @output Motor1 back left thruster, +x thrust
# @output Motor2 front left thruster, -x thrust
# @output Motor3 back right thruster, +x thrust
# @output Motor4 front right thruster, -x thrust
# @output Motor5 front left thruster, +y thrust
# @output Motor6 front right thruster, -y thrust
# @output Motor7 back left thruster, +y thrust
# @output Motor8 back right thruster, -y thrust
#
# @maintainer discower-io
# @url https://atmos.discower.io
# @maintainer Pedro Roque <padr@kth.se>
#
. ${R}etc/init.d/rc.sc_defaults
-5
View File
@@ -324,11 +324,6 @@ fi
uxrce_dds_client start -t udp -p $uxrce_dds_port $uxrce_dds_ns
if param greater -s ZENOH_ENABLE 0
then
zenoh start
fi
if param greater -s MNT_MODE_IN -1
then
gimbal start
+7 -14
View File
@@ -54,13 +54,6 @@ if(CONFIG_MODULES_AIRSHIP_ATT_CONTROL)
)
endif()
if(CONFIG_MODULES_BOAT_RUDDER)
px4_add_romfs_files(
rc.boat_rudder_apps
rc.boat_rudder_defaults
)
endif()
if(CONFIG_MODULES_FW_RATE_CONTROL)
px4_add_romfs_files(
rc.fw_apps
@@ -90,13 +83,6 @@ if(CONFIG_MODULES_ROVER_ACKERMANN)
)
endif()
if(CONFIG_MODULES_ROVER_MECANUM)
px4_add_romfs_files(
rc.rover_mecanum_apps
rc.rover_mecanum_defaults
)
endif()
if(CONFIG_MODULES_SPACECRAFT)
px4_add_romfs_files(
rc.sc_apps
@@ -104,6 +90,13 @@ if(CONFIG_MODULES_SPACECRAFT)
)
endif()
if(CONFIG_MODULES_ROVER_MECANUM)
px4_add_romfs_files(
rc.rover_mecanum_apps
rc.rover_mecanum_defaults
)
endif()
if(CONFIG_MODULES_UUV_ATT_CONTROL)
px4_add_romfs_files(
rc.uuv_apps
@@ -5,17 +5,7 @@
# @type Free-Flyer
# @class Spacecraft
#
# @output Motor1 back left thruster, +x thrust
# @output Motor2 front left thruster, -x thrust
# @output Motor3 back right thruster, +x thrust
# @output Motor4 front right thruster, -x thrust
# @output Motor5 front left thruster, +y thrust
# @output Motor6 front right thruster, -y thrust
# @output Motor7 back left thruster, +y thrust
# @output Motor8 back right thruster, -y thrust
#
# @maintainer DISCOWER
# @url https://atmos.discower.io
#
. ${R}etc/init.d/rc.sc_defaults
@@ -1,8 +0,0 @@
#!/bin/sh
# Standard apps for a boat rudder.
# Start boat rudder module.
boat_rudder start
# Start Land Detector.
land_detector start rover
@@ -1,11 +0,0 @@
#!/bin/sh
# Rudder-steered boats parameters.
set VEHICLE_TYPE boat
param set-default MAV_TYPE 10 # MAV_TYPE_GROUND_ROVER
param set-default CA_AIRFRAME 5 # Rover (Ackermann)
param set-default CA_R_REV 1 # Motor is assumed to be reversible
param set-default EKF2_MAG_TYPE 1 # Make sure magnetometer is fused even when not flying
param set-default NAV_ACC_RAD 0.5 # Waypoint acceptance radius
param set-default EKF2_GBIAS_INIT 0.01
param set-default EKF2_ANGERR_INIT 0.01
+1 -24
View File
@@ -8,9 +8,6 @@
# End Setup for board specific configurations. #
###############################################################################
#
# Set SD logging mode
#
if param compare SDLOG_MODE 1
then
set LOGGER_ARGS "${LOGGER_ARGS} -e"
@@ -31,28 +28,8 @@ then
set LOGGER_ARGS "${LOGGER_ARGS} -a"
fi
#
# Set logging backend
#
if param compare SDLOG_BACKEND 1
then
set LOGGER_ARGS "${LOGGER_ARGS} -m file"
fi
if param compare SDLOG_BACKEND 2
then
set LOGGER_ARGS "${LOGGER_ARGS} -m mavlink"
fi
if param compare SDLOG_BACKEND 3
then
set LOGGER_ARGS "${LOGGER_ARGS} -m all"
fi
#
# Start logger if any logging backend is enabled
#
if ! param compare SDLOG_BACKEND 0
if ! param compare SDLOG_MODE -1
then
logger start -b ${LOGGER_BUF} -t ${LOGGER_ARGS}
fi
-1
View File
@@ -237,7 +237,6 @@ then
qmc5883p -X -q start
rm3100 -X -q start
bmm350 -X -q start
iis2mdc -X -q start
# start last (wait for possible icm20948 passthrough mode)
ak09916 -X -q start
+19 -12
View File
@@ -217,17 +217,6 @@ else
fi
unset BOARD_RC_DEFAULTS
#
# Optional additional init file: rc.additional_init
#
set BOARD_RC_ADDITIONAL_INIT ${R}etc/init.d/rc.additional_init
if [ -f $BOARD_RC_ADDITIONAL_INIT ]
then
echo "Board additional init: ${BOARD_RC_ADDITIONAL_INIT}"
. $BOARD_RC_ADDITIONAL_INIT
fi
unset BOARD_RC_ADDITIONAL_INIT
# Load airframe configuration based on SYS_AUTOSTART parameter
if ! param compare SYS_AUTOSTART 0
then
@@ -624,7 +613,9 @@ else
. ${R}etc/init.d/rc.autostart.post
fi
#
# Bootloader upgrade (ROMFS)
#
set BOARD_BOOTLOADER_UPGRADE ${R}etc/init.d/rc.board_bootloader_upgrade
if [ -f $BOARD_BOOTLOADER_UPGRADE ]
then
@@ -632,6 +623,22 @@ else
fi
unset BOARD_BOOTLOADER_UPGRADE
#
# Bootloader upgrade (SD card)
#
if param compare -s SYS_BL_UPDATE 2
then
if [ -f "/fs/microsd/bl/bl.bin" ]
then
param set SYS_BL_UPDATE 0
param save
echo "bootloader update..."
bl_update "/fs/microsd/bl/bl.bin"
echo "bootloader update done, rebooting"
reboot
fi
fi
#
# Check if UAVCAN is enabled, default to it for ESCs.
#
@@ -49,14 +49,14 @@ for field in spec.parsed_fields():
(package, name) = genmsg.names.package_resource_name(field.base_type)
package = package or spec.package # convert '' to package
print('typedef px4_msgs_msg_%s px4_msgs_msg_px4_msgs__msg__%s;' % (name,name))
print('typedef px4_msg_%s px4_msg_px4__msg__%s;' % (name,name))
}@
typedef struct @uorb_struct px4_msgs_msg_@(file_base_name);
typedef struct @uorb_struct px4_msg_@(file_base_name);
extern const struct dds_cdrstream_desc px4_msgs_msg_@(file_base_name)_cdrstream_desc;
extern const struct dds_cdrstream_desc px4_msg_@(file_base_name)_cdrstream_desc;
#ifdef __cplusplus
}
+1 -2
View File
@@ -14,6 +14,7 @@ class AirframeGroup(object):
self.af_class = af_class
self.airframes = []
def AddAirframe(self, airframe):
"""
Add airframe to the airframe group
@@ -106,8 +107,6 @@ class AirframeGroup(object):
return "Balloon"
elif (self.type == "Vectored 6 DOF UUV"):
return "Vectored6DofUUV"
elif self.type == "Free-Flyer":
return "FreeFlyer"
return "AirframeUnknown"
def GetAirframes(self):
+5 -24
View File
@@ -42,7 +42,6 @@ import os
import argparse
import re
import sys
import json
try:
import em
@@ -125,7 +124,7 @@ def generate_by_template(output_file, template_file, em_globals):
return True
def generate_topics_list_file_from_files(files, outputdir, template_filename, templatedir, rihs_path):
def generate_topics_list_file_from_files(files, outputdir, template_filename, templatedir):
# generate cpp file with topics list
filenames = []
for filename in [os.path.basename(p) for p in files if os.path.basename(p).endswith(".msg")]:
@@ -139,27 +138,11 @@ def generate_topics_list_file_from_files(files, outputdir, template_filename, te
for filename in [os.path.basename(p) for p in files if os.path.basename(p).endswith(".msg")]:
full_base_names.append(filename.replace(".msg",""))
rihs01_hashes = dict()
if rihs_path != '':
for topic in full_base_names:
with open(rihs_path + "/msg/" + topic + ".json") as f:
d = json.load(f)
assert d['type_hashes'][0]['hash_string'][:7] == 'RIHS01_'
rihs01_hash = d['type_hashes'][0]['hash_string'][7:]
byte_array = [f"0x{rihs01_hash[i:i+2]}" for i in range(0, len(rihs01_hash), 2)]
c_code = f"{{ {', '.join(byte_array)} }};"
rihs01_hashes[topic] = c_code
topics = []
datatypes_with_topics = dict()
for msg_filename in files:
datatype = re.sub(r'(?<!^)(?=[A-Z])', '_', os.path.basename(msg_filename)).lower().replace(".msg","")
datatypes_with_topics[datatype] = get_topics(msg_filename)
topics.extend(datatypes_with_topics[datatype])
topics.extend(get_topics(msg_filename))
tl_globals = {"msgs": filenames, "topics": topics, "datatypes": datatypes, "full_base_names": full_base_names, "rihs01_hashes": rihs01_hashes, "datatypes_with_topics": datatypes_with_topics}
tl_globals = {"msgs": filenames, "topics": topics, "datatypes": datatypes, "full_base_names": full_base_names}
tl_template_file = os.path.join(templatedir, template_filename)
tl_out_file = os.path.join(outputdir, template_filename.replace(".em", ""))
@@ -179,15 +162,13 @@ if __name__ == "__main__":
parser.add_argument('-p', dest='prefix', default='',
help='string added as prefix to the output file '
' name when converting directories')
parser.add_argument('--rihs', dest='rihs', default='',
help='path where rihs01 json files located')
args = parser.parse_args()
if args.zenoh_config:
generate_topics_list_file_from_files(args.file, args.outputdir, ZENOH_TEMPLATE_FILE[0], args.templatedir, args.rihs)
generate_topics_list_file_from_files(args.file, args.outputdir, ZENOH_TEMPLATE_FILE[0], args.templatedir)
exit(0)
elif args.zenoh_pub_sub:
generate_topics_list_file_from_files(args.file, args.outputdir, ZENOH_TEMPLATE_FILE[1], args.templatedir, args.rihs)
generate_topics_list_file_from_files(args.file, args.outputdir, ZENOH_TEMPLATE_FILE[1], args.templatedir)
exit(0)
else:
print('Error: either --headers or --sources must be specified')
@@ -74,7 +74,7 @@ full_base_names.sort()
@[for idx, topic_name in enumerate(datatypes)]@
@{
type_topic_count = len(datatypes_with_topics[topic_name])
type_topic_count = len([e for e in topic_names_all if e.startswith(topic_name)])
}@
#ifdef CONFIG_ZENOH_PUBSUB_@(topic_name.upper())
# define CONFIG_ZENOH_PUBSUB_@(topic_name.upper())_COUNT @(type_topic_count)
@@ -88,28 +88,9 @@ type_topic_count = len(datatypes_with_topics[topic_name])
CONFIG_ZENOH_PUBSUB_@(topic_name.upper())_COUNT + \
@[end for] 0
@[for topic_name, rihs01_hash in rihs01_hashes.items()]@
const uint8_t @(topic_name)_hash[32] = @(rihs01_hash)
@[end for]
@[for idx, topic_name in enumerate(datatypes)]@
#ifdef CONFIG_ZENOH_PUBSUB_@(topic_name.upper())
@{
topic_names = datatypes_with_topics[topic_name]
}@
const orb_metadata* @(topic_name)_topic_meta[@(len(topic_names))] = {
@[for topic_name_inst in topic_names]@
ORB_ID(@(topic_name_inst)),
@[end for]};
#endif
@[end for]
typedef struct {
const char *data_type_name;
const uint32_t *ops;
const uint8_t *hash;
const orb_metadata** orb_topic;
const uint8_t orb_topics_size;
const orb_metadata* orb_meta;
} UorbPubSubTopicBinder;
const UorbPubSubTopicBinder _topics[ZENOH_PUBSUB_COUNT] {
@@ -119,95 +100,54 @@ uorb_id_idx = 0
@[for idx, topic_name in enumerate(datatypes)]@
#ifdef CONFIG_ZENOH_PUBSUB_@(topic_name.upper())
@{
topic_names = datatypes_with_topics[topic_name]
topic_names = [e for e in topic_names_all if e.startswith(topic_name)]
}@
@[for topic_name_inst in topic_names]@
{
"@(topic_name)",
px4_msgs_msg_@(topic_dict[topic_name])_cdrstream_desc.ops.ops,
@(topic_dict[topic_name])_hash,
@(topic_name)_topic_meta,
@(len(topic_names)),
px4_msg_@(topic_dict[topic_name])_cdrstream_desc.ops.ops,
ORB_ID(@(topic_name_inst))
},
#endif
@{
uorb_id_idx += 1
}@
@[end for]#endif
@[end for]
};
uORB_Zenoh_Publisher* genPublisher(const orb_metadata *meta, int instance) {
uORB_Zenoh_Publisher* genPublisher(const orb_metadata *meta) {
for (auto &pub : _topics) {
for(int i = 0; i < pub.orb_topics_size; i++) {
if(pub.orb_topic[i]->o_id == meta->o_id) {
return new uORB_Zenoh_Publisher(meta, pub.ops, instance);
}
if(pub.orb_meta->o_id == meta->o_id) {
return new uORB_Zenoh_Publisher(meta, pub.ops);
}
}
return NULL;
}
uORB_Zenoh_Publisher* genPublisher(const char *name, int instance) {
uORB_Zenoh_Publisher* genPublisher(const char *name) {
for (auto &pub : _topics) {
for(int i = 0; i < pub.orb_topics_size; i++) {
if(strcmp(pub.orb_topic[i]->o_name, name) == 0) {
return new uORB_Zenoh_Publisher(pub.orb_topic[i], pub.ops, instance);
}
if(strcmp(pub.orb_meta->o_name, name) == 0) {
return new uORB_Zenoh_Publisher(pub.orb_meta, pub.ops);
}
}
return NULL;
}
Zenoh_Subscriber* genSubscriber(const orb_metadata *meta, int instance) {
Zenoh_Subscriber* genSubscriber(const orb_metadata *meta) {
for (auto &sub : _topics) {
for(int i = 0; i < sub.orb_topics_size; i++) {
if(sub.orb_topic[i]->o_id == meta->o_id) {
return new uORB_Zenoh_Subscriber(meta, sub.ops, instance);
}
if(sub.orb_meta->o_id == meta->o_id) {
return new uORB_Zenoh_Subscriber(meta, sub.ops);
}
}
return NULL;
}
Zenoh_Subscriber* genSubscriber(const char *name, int instance) {
Zenoh_Subscriber* genSubscriber(const char *name) {
for (auto &sub : _topics) {
for(int i = 0; i < sub.orb_topics_size; i++) {
if(strcmp(sub.orb_topic[i]->o_name, name) == 0) {
return new uORB_Zenoh_Subscriber(sub.orb_topic[i], sub.ops, instance);
}
}
}
return NULL;
}
const char* getTypeName(const char *name) {
for (auto &sub : _topics) {
for(int i = 0; i < sub.orb_topics_size; i++) {
if(strcmp(sub.orb_topic[i]->o_name, name) == 0) {
return sub.data_type_name;
}
}
}
return NULL;
}
const uint8_t* getRIHS01_Hash(const orb_metadata *meta) {
for (auto &sub : _topics) {
for(int i = 0; i < sub.orb_topics_size; i++) {
if(sub.orb_topic[i]->o_id == meta->o_id) {
return sub.hash;
}
}
}
return NULL;
}
const uint8_t* getRIHS01_Hash(const char *name) {
for (auto &sub : _topics) {
for(int i = 0; i < sub.orb_topics_size; i++) {
if(strcmp(sub.orb_topic[i]->o_name, name) == 0) {
return sub.hash;
}
if(strcmp(sub.orb_meta->o_name, name) == 0) {
return new uORB_Zenoh_Subscriber(sub.orb_meta, sub.ops);
}
}
return NULL;
@@ -75,6 +75,7 @@ CONFIG_MODULES_UUV_POS_CONTROL=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
CONFIG_SYSTEMCMDS_GPIO=y
+1
View File
@@ -35,6 +35,7 @@ CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_SIMULATION_SIMULATOR_SIH=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_DMESG=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
CONFIG_SYSTEMCMDS_HARDFAULT_LOG=y
-1
View File
@@ -21,7 +21,6 @@ CONFIG_COMMON_MAGNETOMETER=y
CONFIG_DATAMAN_PERSISTENT_STORAGE=n
CONFIG_DRIVERS_PWM_OUT=y
CONFIG_COMMON_RC=y
CONFIG_DRIVERS_PCA9685_PWM_OUT=y
CONFIG_DRIVERS_POWER_MONITOR_INA226=y
CONFIG_DRIVERS_POWER_MONITOR_INA228=y
CONFIG_DRIVERS_POWER_MONITOR_INA238=y
@@ -14,7 +14,7 @@ param set-default SYS_DM_BACKEND 1
# Set TELEM1 as default mavlink connection
param set-default MAV_0_CONFIG 0
# Disable logger writing to FRAM, only stream over MAVLINK
param set-default SDLOG_BACKEND 2
set LOGGER_ARGS "-m mavlink"
# 200kOhm/10kOhm voltage divider on V_BAT
param set-default BAT1_V_DIV 21
+11 -17
View File
@@ -12,20 +12,17 @@ board_adc start
bmi088 -A -R 0 -s start
bmi088 -G -R 0 -s start
# MAG on I2C4, ROTATION_ROLL_180=8
if ver hwtypecmp V6S013 V6S015
then
# Revision(s) with BMM150
# MAG on I2C4, ROTATION_ROLL_180=8
bmm150 -I -R 8 start
else
# Revision(s) with BMM350
# MAG on I2C4, ROTATION_ROLL_180=8
bmm350 -I -R 8 start
fi
# BARO on I2C4
bmp388 -I -b 4 -a 0x77 start
# External sensors on I2C1
if param compare SENS_EN_INA226 1
then
# Start Digital power monitors
@@ -62,17 +59,14 @@ fi
if param compare BAT1_V_CHANNEL -2
then
if [ "$INA_CONFIGURED" != "yes" ]
then
param set BAT1_V_CHANNEL -1
fi
if [ "$INA_CONFIGURED" != "yes" ]
then
param set BAT1_V_CHANNEL -1
fi
fi
# External compass IST8310 on I2C1
# External compass on GPS1/I2C1 (the 3rd external bus): standard Holybro Pixhawk 4 or CUAV V5 GPS/compass puck (with lights, safety button, and buzzer)
ist8310 -X -b 1 -R 10 start
# Start an external PWM generator
if param greater PCA9685_EN_BUS 0
then
pca9685_pwm_out start -b 1
fi
# BARO on I2C4
bmp388 -I -b 4 -a 0x77 start
+1
View File
@@ -71,6 +71,7 @@ CONFIG_MODULES_UUV_POS_CONTROL=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_DMESG=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
+1
View File
@@ -8,4 +8,5 @@ CONFIG_MODULES_LOCAL_POSITION_ESTIMATOR=n
CONFIG_BOARD_TESTING=y
CONFIG_DRIVERS_TEST_PPM=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_MICROBENCH=y
@@ -74,6 +74,7 @@ CONFIG_MODULES_UXRCE_DDS_CLIENT=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_DMESG=y
CONFIG_SYSTEMCMDS_GPIO=y
@@ -75,6 +75,7 @@ CONFIG_MODULES_UXRCE_DDS_CLIENT=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_DMESG=y
CONFIG_SYSTEMCMDS_GPIO=y
@@ -75,6 +75,7 @@ CONFIG_MODULES_UUV_POS_CONTROL=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_DMESG=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
+1
View File
@@ -66,6 +66,7 @@ CONFIG_MODULES_UXRCE_DDS_CLIENT=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_DMESG=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
CONFIG_SYSTEMCMDS_GPIO=y
+1
View File
@@ -68,6 +68,7 @@ CONFIG_MODULES_UXRCE_DDS_CLIENT=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_DMESG=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
CONFIG_SYSTEMCMDS_GPIO=y
@@ -38,5 +38,5 @@ param set-default SYS_DM_BACKEND 1
# Ignore that there is no SD card
param set-default COM_ARM_SDCARD 0
# Disable logging
param set-default SDLOG_BACKEND 0
# Don't try to log onto SD card
param set-default SDLOG_MODE -1
@@ -38,5 +38,5 @@ param set-default SYS_DM_BACKEND 1
# Ignore that there is no SD card
param set-default COM_ARM_SDCARD 0
# Disable logging
param set-default SDLOG_BACKEND 0
# Don't try to log onto SD card
param set-default SDLOG_MODE -1
+1
View File
@@ -79,6 +79,7 @@ CONFIG_MODULES_UUV_POS_CONTROL=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_DMESG=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
+1
View File
@@ -84,6 +84,7 @@ CONFIG_MODULES_UXRCE_DDS_CLIENT=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_DMESG=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
+1
View File
@@ -79,6 +79,7 @@ CONFIG_MODULES_UXRCE_DDS_CLIENT=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_DMESG=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
+1
View File
@@ -67,6 +67,7 @@ CONFIG_MODULES_UXRCE_DDS_CLIENT=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_DMESG=y
CONFIG_SYSTEMCMDS_GPIO=y
@@ -73,6 +73,7 @@ CONFIG_MODULES_UUV_POS_CONTROL=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_DMESG=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
+1
View File
@@ -73,6 +73,7 @@ CONFIG_MODULES_UUV_POS_CONTROL=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_DMESG=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
+1
View File
@@ -73,6 +73,7 @@ CONFIG_MODULES_UUV_POS_CONTROL=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_DMESG=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
+1
View File
@@ -75,6 +75,7 @@ CONFIG_MODULES_UUV_POS_CONTROL=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
CONFIG_SYSTEMCMDS_GPIO=y
+1
View File
@@ -8,4 +8,5 @@ CONFIG_MODULES_LOCAL_POSITION_ESTIMATOR=n
CONFIG_BOARD_TESTING=y
CONFIG_DRIVERS_TEST_PPM=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_MICROBENCH=y
-1
View File
@@ -14,7 +14,6 @@ CONFIG_MODULES_EKF2=y
CONFIG_MODULES_MAVLINK=y
CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_ZENOH=y
CONFIG_SYSTEMCMDS_I2CDETECT=y
CONFIG_SYSTEMCMDS_LED_CONTROL=y
CONFIG_SYSTEMCMDS_MFT=y
@@ -182,7 +182,6 @@ CONFIG_NET_SOLINGER=y
CONFIG_NET_TCP=y
CONFIG_NET_TCPBACKLOG=y
CONFIG_NET_TCP_DELAYED_ACK=y
CONFIG_NET_TCP_KEEPALIVE=y
CONFIG_NET_TCP_WRITE_BUFFERS=y
CONFIG_NET_TIMESTAMP=y
CONFIG_NET_UDP=y
@@ -208,7 +207,6 @@ CONFIG_PIPES=y
CONFIG_PREALLOC_TIMERS=50
CONFIG_PRIORITY_INHERITANCE=y
CONFIG_PTHREAD_MUTEX_ROBUST=y
CONFIG_PTHREAD_MUTEX_TYPES=y
CONFIG_PTHREAD_STACK_MIN=512
CONFIG_RAM_SIZE=272000
CONFIG_RAM_START=0x20400000
+57
View File
@@ -0,0 +1,57 @@
# CONFIG_BOARD_ROMFSROOT is not set
CONFIG_BOARD_SERIAL_GPS1="/dev/ttyS1"
CONFIG_BOARD_SERIAL_GPS2="/dev/ttyS4"
CONFIG_BOARD_SERIAL_RC="/dev/ttyS5"
CONFIG_BOARD_SERIAL_TEL1="/dev/ttyS2"
CONFIG_BOARD_SERIAL_TEL4="/dev/ttyS3"
CONFIG_BOARD_UAVCAN_INTERFACES=1
CONFIG_COMMON_LIGHT=y
CONFIG_DRIVERS_ADC_BOARD_ADC=y
CONFIG_DRIVERS_GPS=y
CONFIG_DRIVERS_IRLOCK=y
CONFIG_DRIVERS_MAGNETOMETER_ISENTEK_IST8310=y
CONFIG_DRIVERS_MAGNETOMETER_LIS3MDL=y
CONFIG_DRIVERS_RC_INPUT=y
CONFIG_DRIVERS_SAFETY_BUTTON=y
CONFIG_DRIVERS_UAVCAN=y
CONFIG_EXAMPLES_FAKE_GPS=y
CONFIG_MODULES_AIRSPEED_SELECTOR=y
CONFIG_MODULES_ATTITUDE_ESTIMATOR_Q=y
CONFIG_MODULES_BATTERY_STATUS=y
CONFIG_MODULES_CAMERA_FEEDBACK=y
CONFIG_MODULES_COMMANDER=y
CONFIG_MODULES_ESC_BATTERY=y
CONFIG_MODULES_EVENTS=y
CONFIG_MODULES_FW_ATT_CONTROL=y
CONFIG_MODULES_FW_AUTOTUNE_ATTITUDE_CONTROL=y
CONFIG_MODULES_FW_MODE_MANAGER=y
CONFIG_MODULES_FW_LATERAL_LONGITUDINAL_CONTROL=y
CONFIG_MODULES_FW_RATE_CONTROL=y
CONFIG_MODULES_GYRO_CALIBRATION=y
CONFIG_MODULES_GYRO_FFT=y
CONFIG_MODULES_LANDING_TARGET_ESTIMATOR=y
CONFIG_MODULES_LAND_DETECTOR=y
CONFIG_MODULES_LOAD_MON=y
CONFIG_MODULES_LOCAL_POSITION_ESTIMATOR=y
CONFIG_MODULES_LOGGER=y
CONFIG_MODULES_MAG_BIAS_ESTIMATOR=y
CONFIG_MODULES_MANUAL_CONTROL=y
CONFIG_MODULES_MC_ATT_CONTROL=y
CONFIG_MODULES_MC_AUTOTUNE_ATTITUDE_CONTROL=y
CONFIG_MODULES_MC_HOVER_THRUST_ESTIMATOR=y
CONFIG_MODULES_MC_POS_CONTROL=y
CONFIG_MODULES_MC_RATE_CONTROL=y
CONFIG_MODULES_NAVIGATOR=y
CONFIG_MODULES_RC_UPDATE=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_MODULES_ZENOH=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_DMESG=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
CONFIG_SYSTEMCMDS_HARDFAULT_LOG=y
CONFIG_SYSTEMCMDS_NSHTERM=y
CONFIG_SYSTEMCMDS_PERF=y
CONFIG_SYSTEMCMDS_REFLECT=y
CONFIG_SYSTEMCMDS_SERIAL_TEST=y
CONFIG_SYSTEMCMDS_TUNE_CONTROL=y
@@ -75,7 +75,6 @@ CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_UXRCE_DDS_CLIENT=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_MODULES_ZENOH=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_DMESG=y
@@ -49,7 +49,6 @@ CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEBUG_TCBINFO=y
CONFIG_DEV_FIFO_SIZE=0
CONFIG_DEV_PIPE_SIZE=70
CONFIG_DEV_URANDOM=y
CONFIG_ETH0_PHY_DP83825I=y
CONFIG_FAT_DMAMEMORY=y
CONFIG_FAT_LCNAMES=y
@@ -156,8 +155,8 @@ CONFIG_NETDEV_LATEINIT=y
CONFIG_NETDEV_PHY_IOCTL=y
CONFIG_NETINIT_DHCPC=y
CONFIG_NETINIT_DNS=y
CONFIG_NETINIT_DNSIPADDR=0xA290AFE
CONFIG_NETINIT_DRIPADDR=0xA290AFE
CONFIG_NETINIT_DNSIPADDR=0XC0A800FE
CONFIG_NETINIT_DRIPADDR=0XC0A800FE
CONFIG_NETINIT_RETRY_MOUNTPATH=10
CONFIG_NETINIT_THREAD=y
CONFIG_NETINIT_THREAD_PRIORITY=49
@@ -168,18 +167,15 @@ CONFIG_NET_BROADCAST=y
CONFIG_NET_CAN=y
CONFIG_NET_CAN_EXTID=y
CONFIG_NET_CAN_NOTIFIER=y
CONFIG_NET_CAN_RAW_FILTER_MAX=1
CONFIG_NET_CAN_RAW_TX_DEADLINE=y
CONFIG_NET_CAN_SOCK_OPTS=y
CONFIG_NET_ETH_PKTSIZE=1518
CONFIG_NET_ICMP=y
CONFIG_NET_ICMP_SOCKET=y
CONFIG_NET_IGMP=y
CONFIG_NET_SOLINGER=y
CONFIG_NET_TCP=y
CONFIG_NET_TCPBACKLOG=y
CONFIG_NET_TCP_DELAYED_ACK=y
CONFIG_NET_TCP_KEEPALIVE=y
CONFIG_NET_TCP_WRITE_BUFFERS=y
CONFIG_NET_TIMESTAMP=y
CONFIG_NET_UDP=y
@@ -200,7 +196,6 @@ CONFIG_NSH_VARS=y
CONFIG_PIPES=y
CONFIG_PREALLOC_TIMERS=50
CONFIG_PRIORITY_INHERITANCE=y
CONFIG_PTHREAD_MUTEX_TYPES=y
CONFIG_PTHREAD_STACK_MIN=512
CONFIG_RAM_SIZE=1048576
CONFIG_RAM_START=0x20200000
+1
View File
@@ -47,6 +47,7 @@ CONFIG_MODULES_SENSORS=y
# CONFIG_SENSORS_VEHICLE_AIRSPEED is not set
# CONFIG_SENSORS_VEHICLE_OPTICAL_FLOW is not set
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_HARDFAULT_LOG=y
CONFIG_SYSTEMCMDS_MFT=y
CONFIG_SYSTEMCMDS_MTD=y
+1
View File
@@ -79,6 +79,7 @@ CONFIG_MODULES_UXRCE_DDS_CLIENT=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
CONFIG_SYSTEMCMDS_GPIO=y
+1
View File
@@ -80,6 +80,7 @@ CONFIG_MODULES_UXRCE_DDS_CLIENT=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
CONFIG_SYSTEMCMDS_GPIO=y
+1
View File
@@ -77,6 +77,7 @@ CONFIG_MODULES_UXRCE_DDS_CLIENT=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
CONFIG_SYSTEMCMDS_GPIO=y
+1
View File
@@ -83,6 +83,7 @@ CONFIG_MODULES_UXRCE_DDS_CLIENT=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_DMESG=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
+1
View File
@@ -91,6 +91,7 @@ CONFIG_MODULES_UXRCE_DDS_CLIENT=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_DMESG=y
CONFIG_SYSTEMCMDS_GPIO=y
-1
View File
@@ -89,7 +89,6 @@ CONFIG_MODULES_SENSORS=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_UXRCE_DDS_CLIENT=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_MODULES_ZENOH=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_DMESG=y
@@ -55,7 +55,6 @@ CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEBUG_TCBINFO=y
CONFIG_DEV_FIFO_SIZE=0
CONFIG_DEV_PIPE_SIZE=70
CONFIG_DEV_URANDOM=y
CONFIG_ETH0_PHY_MULTI=y
CONFIG_FAT_DMAMEMORY=y
CONFIG_FAT_LCNAMES=y
@@ -215,18 +214,15 @@ CONFIG_NET_BROADCAST=y
CONFIG_NET_CAN=y
CONFIG_NET_CAN_EXTID=y
CONFIG_NET_CAN_NOTIFIER=y
CONFIG_NET_CAN_RAW_FILTER_MAX=1
CONFIG_NET_CAN_RAW_TX_DEADLINE=y
CONFIG_NET_CAN_SOCK_OPTS=y
CONFIG_NET_ETH_PKTSIZE=1518
CONFIG_NET_ICMP=y
CONFIG_NET_ICMP_SOCKET=y
CONFIG_NET_IGMP=y
CONFIG_NET_SOLINGER=y
CONFIG_NET_TCP=y
CONFIG_NET_TCPBACKLOG=y
CONFIG_NET_TCP_DELAYED_ACK=y
CONFIG_NET_TCP_KEEPALIVE=y
CONFIG_NET_TCP_WRITE_BUFFERS=y
CONFIG_NET_TIMESTAMP=y
CONFIG_NET_UDP=y
@@ -247,7 +243,6 @@ CONFIG_NSH_VARS=y
CONFIG_PIPES=y
CONFIG_PREALLOC_TIMERS=50
CONFIG_PRIORITY_INHERITANCE=y
CONFIG_PTHREAD_MUTEX_TYPES=y
CONFIG_PTHREAD_STACK_MIN=512
CONFIG_RAMTRON_SETSPEED=y
CONFIG_RAM_SIZE=1835008
@@ -72,6 +72,7 @@ CONFIG_MODULES_UXRCE_DDS_CLIENT=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_DMESG=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
+1
View File
@@ -74,6 +74,7 @@ CONFIG_MODULES_UXRCE_DDS_CLIENT=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
CONFIG_SYSTEMCMDS_GPIO=y
+1
View File
@@ -74,6 +74,7 @@ CONFIG_MODULES_UXRCE_DDS_CLIENT=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
CONFIG_SYSTEMCMDS_GPIO=y
+1
View File
@@ -61,6 +61,7 @@ CONFIG_MODULES_SIMULATION_SIMULATOR_SIH=y
CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_BSONDUMP=y
CONFIG_SYSTEMCMDS_DMESG=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
+1
View File
@@ -66,6 +66,7 @@ CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_DMESG=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
CONFIG_SYSTEMCMDS_GPIO=y
+1
View File
@@ -65,6 +65,7 @@ CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_DMESG=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
CONFIG_SYSTEMCMDS_GPIO=y
+1
View File
@@ -65,6 +65,7 @@ CONFIG_MODULES_TEMPERATURE_COMPENSATION=y
CONFIG_MODULES_VTOL_ATT_CONTROL=y
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
CONFIG_SYSTEMCMDS_BL_UPDATE=y
CONFIG_BL_UPDATE_BL_ROMFS=y
CONFIG_SYSTEMCMDS_DMESG=y
CONFIG_SYSTEMCMDS_DUMPFILE=y
CONFIG_SYSTEMCMDS_GPIO=y
-5
View File
@@ -339,11 +339,6 @@ if(EXISTS ${BOARD_DEFCONFIG})
endif()
endif()
# ADDITIONAL INIT
if(ADDITIONAL_INIT)
set(config_additional_init ${ADDITIONAL_INIT} CACHE INTERNAL "additional init" FORCE)
endif()
if(UAVCAN_INTERFACES)
set(config_uavcan_num_ifaces ${UAVCAN_INTERFACES} CACHE INTERNAL "UAVCAN interfaces" FORCE)
endif()
-197
View File
@@ -1,197 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
version="1.1"
id="draw"
x="0px"
y="0px"
viewBox="0 0 291.424 291.77"
enable-background="new 0 0 291.424 291.77"
xml:space="preserve"
sodipodi:docname="FreeFlyer.svg"
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"><metadata
id="metadata13908"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>QuadRotorX</dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs13906"><rect
x="64.295094"
y="257.16159"
width="20.004284"
height="19.434001"
id="rect1674" /><rect
x="57.181928"
y="12.768183"
width="21.455602"
height="14.069247"
id="rect1668" /><rect
x="64.295097"
y="257.16159"
width="20.004284"
height="19.434002"
id="rect1674-3" /><rect
x="64.295097"
y="257.16159"
width="20.004284"
height="19.434002"
id="rect1674-6" /><rect
x="64.295097"
y="257.16159"
width="20.004284"
height="19.434002"
id="rect1674-8" /><rect
x="64.295097"
y="257.16159"
width="20.004284"
height="19.434002"
id="rect1674-9" /><rect
x="64.295097"
y="257.16159"
width="20.004284"
height="19.434002"
id="rect1674-9-0" /><rect
x="64.295097"
y="257.16159"
width="20.004284"
height="19.434002"
id="rect1674-9-0-3" /><rect
x="64.295097"
y="257.16159"
width="20.004284"
height="19.434002"
id="rect1674-9-0-5" /></defs><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1131"
id="namedview13904"
showgrid="true"
showguides="false"
inkscape:zoom="2"
inkscape:cx="37"
inkscape:cy="143.75"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="draw"
inkscape:showpageshadow="2"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"><inkscape:grid
type="xygrid"
id="grid14610" /></sodipodi:namedview><title
id="title13869">QuadRotorX</title>
<rect
style="fill:#4ec3e8;fill-opacity:0.8;stroke-width:0.703099"
id="rect866"
width="182.87863"
height="182.87863"
x="54.336742"
y="54.008221" /><path
style="fill:#159e1f;fill-opacity:0.8;stroke-width:1.32638"
d="m 41.75804,283.31181 64.75142,-0.1091 -34.35904,-46.53234"
id="path978" /><path
style="fill:#159e1f;fill-opacity:0.8;stroke-width:1.32638"
d="m 8.0625538,189.05596 0.1091,64.75142 46.5323452,-34.35904"
id="path978-3" /><path
style="fill:#159e1f;fill-opacity:0.8;stroke-width:1.32638"
d="m 7.6111718,42.233006 0.1091,64.751414 46.5323442,-34.359034"
id="path978-3-5" /><path
style="fill:#159e1f;fill-opacity:0.8;stroke-width:1.32638"
d="M 283.3143,102.92315 283.2052,38.171731 236.67284,72.530766"
id="path978-3-0" /><path
style="fill:#159e1f;fill-opacity:0.8;stroke-width:1.32638"
d="m 283.76568,249.7461 -0.1091,-64.75142 -46.53235,34.35904"
id="path978-3-5-9" /><path
style="fill:#159e1f;fill-opacity:0.8;stroke-width:1.32638"
d="m 186.0159,282.76127 64.75142,-0.1091 -34.35904,-46.53235"
id="path978-5" /><path
style="fill:#159e1f;fill-opacity:0.8;stroke-width:1.32638"
d="m 249.48837,7.3723165 -64.75142,0.1091 34.35904,46.5323455"
id="path978-6" /><path
style="fill:#159e1f;fill-opacity:0.8;stroke-width:1.32638"
d="M 105.23051,7.9228645 40.479095,8.0319644 74.838131,54.56431"
id="path978-5-2" /><path
fill="#ffffff"
stroke="#000000"
stroke-miterlimit="10"
d="m 177.46535,152.08429 -25.44869,25.44869 c -2.72029,2.72029 -7.13013,2.72029 -9.84972,0 l -25.44868,-25.44869 c -2.7203,-2.72029 -2.7203,-7.13013 0,-9.84972 l 25.44868,-25.44868 c 2.72029,-2.72029 7.13013,-2.72029 9.84972,0 l 25.44869,25.44868 c 2.72029,2.72029 2.72029,7.13013 0,9.84972 z"
id="path13875-2"
style="stroke-width:0.703099" /><polygon
fill="#ff442b"
stroke="#000000"
stroke-miterlimit="10"
points="145.645,117.211 163.823,168.211 127.468,168.211 "
id="polygon13877-7"
transform="matrix(0.70309945,0,0,0.70309945,44.68853,44.358917)" /><text
xml:space="preserve"
id="text1666"
style="fill:#ffffff;fill-opacity:0.80000001;white-space:pre;shape-inside:url(#rect1668)" /><text
xml:space="preserve"
id="text1672"
style="font-size:16px;white-space:pre;shape-inside:url(#rect1674);fill:#ffffff;fill-opacity:0.8"
transform="matrix(1.8712033,0,0,1.8712033,-56.149908,-232.98716)"><tspan
x="64.294922"
y="271.72011"
id="tspan2022">1</tspan></text><text
xml:space="preserve"
id="text1672-6"
style="font-size:16px;white-space:pre;shape-inside:url(#rect1674-3);display:inline;fill:#ffffff;fill-opacity:0.8"
transform="matrix(1.8712033,0,0,1.8712033,-54.90599,-471.96664)"><tspan
x="64.294922"
y="271.72011"
id="tspan2024">2</tspan></text><text
xml:space="preserve"
id="text1672-1"
style="font-size:16px;white-space:pre;shape-inside:url(#rect1674-6);display:inline;fill:#ffffff;fill-opacity:0.8"
transform="matrix(1.8712033,0,0,1.8712033,88.181331,-233.48182)"><tspan
x="64.294922"
y="271.72011"
id="tspan2026">3</tspan></text><text
xml:space="preserve"
id="text1672-7"
style="font-size:16px;white-space:pre;shape-inside:url(#rect1674-8);display:inline;fill:#ffffff;fill-opacity:0.8"
transform="matrix(1.8712033,0,0,1.8712033,89.923516,-472.9994)"><tspan
x="64.294922"
y="271.72011"
id="tspan2028">4</tspan></text><text
xml:space="preserve"
id="text1672-2"
style="font-size:16px;white-space:pre;shape-inside:url(#rect1674-9);display:inline;fill:#ffffff;fill-opacity:0.8"
transform="matrix(1.8712033,0,0,1.8712033,-107.88311,-425.85878)"><tspan
x="64.294922"
y="271.72011"
id="tspan2030">5</tspan></text><text
xml:space="preserve"
id="text1672-2-2"
style="font-size:16px;white-space:pre;shape-inside:url(#rect1674-9-0);display:inline;fill:#ffffff;fill-opacity:0.8"
transform="matrix(1.8712033,0,0,1.8712033,140.31603,-426.60417)"><tspan
x="64.294922"
y="271.72011"
id="tspan2032">6</tspan></text><text
xml:space="preserve"
id="text1672-2-2-7"
style="font-size:16px;white-space:pre;shape-inside:url(#rect1674-9-0-3);display:inline;fill:#ffffff;fill-opacity:0.8"
transform="matrix(1.8712033,0,0,1.8712033,-106.57328,-277.85487)"><tspan
x="64.294922"
y="271.72011"
id="tspan2034">7</tspan></text><text
xml:space="preserve"
id="text1672-2-2-9"
style="font-size:16px;white-space:pre;shape-inside:url(#rect1674-9-0-5);display:inline;fill:#ffffff;fill-opacity:0.8"
transform="matrix(1.8712033,0,0,1.8712033,140.59859,-279.63807)"><tspan
x="64.294922"
y="271.72011"
id="tspan2036">8</tspan></text></svg>

Before

Width:  |  Height:  |  Size: 7.4 KiB

+2 -29
View File
@@ -90,8 +90,6 @@ This is documented below.
The best way to customize the system startup is to introduce a [new frame configuration](../dev_airframes/adding_a_new_frame.md).
The frame configuration file can be included in the firmware or on an SD Card.
#### Dynamic customization
If you only need to "tweak" the existing configuration, such as starting one more application or setting the value of a few parameters, you can specify these by creating two files in the `/etc/` directory of the SD Card:
- [/etc/config.txt](#customizing-the-configuration-config-txt): modify parameter values
@@ -108,7 +106,7 @@ If editing on Windows use a suitable editor.
These files are referenced in PX4 code as `/fs/microsd/etc/config.txt` and `/fs/microsd/etc/extras.txt`, where the root folder of the microsd card is identified by the path `/fs/microsd`.
:::
##### Customizing the Configuration (config.txt)
#### Customizing the Configuration (config.txt)
The `config.txt` file can be used to modify parameters.
It is loaded after the main system has been configured and _before_ it is booted.
@@ -120,7 +118,7 @@ param set-default PWM_MAIN_DIS3 1000
param set-default PWM_MAIN_MIN3 1120
```
##### Starting Additional Applications (extras.txt)
#### Starting Additional Applications (extras.txt)
The `extras.txt` can be used to start additional applications after the main system boot.
Typically these would be payload controllers or similar optional custom components.
@@ -147,28 +145,3 @@ The following example shows how to start custom applications:
mandatory_app start # Will abort boot if mandatory_app is unknown or fails
```
#### Additional customization
In rare cases where the desired setup cannot be achieved through frame configuration or dynamic customization,
you can add a script that will be contained in the binary.
**Note**: In almost all cases, you should use a frame configuration. This method should only be used for
edge-cases such as customizing `cannode` based boards.
- Add a new init script in `boards/<vendor>/<board>/init` that will run during board startup. For example:
```sh
# File: boards/<vendor>/<board>/init/rc.additional
param set-default <param> <value>
```
- Add a new board variant in `boards/<vendor>/<board>/<variant>.px4board` that includes the additional script. For example:
```sh
# File: boards/<vendor>/<board>/var.px4board
CONFIG_BOARD_ADDITIONAL_INIT="rc.additional"
```
- Compile the firmware with your new variant by appending the variant name to the compile target. For example:
```sh
make <target>_var
```
+2 -3
View File
@@ -35,15 +35,14 @@ The parameters you are most likely to change are listed below.
| Parameter | Description |
| ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [SDLOG_MODE](../advanced_config/parameter_reference.md#SDLOG_MODE) | Logging Mode. Defines when logging starts and stops.<br />- `0`: Log when armed until disarm (default).<br />- `1`: Log from boot until disarm.<br />- `2`: Log from boot until shutdown.<br />- `3`: Log based on the [AUX1 RC channel](../advanced_config/parameter_reference.md#RC_MAP_AUX1).<br />- `4`: Log from first armed until shutdown. |
| [SDLOG_BACKEND](../advanced_config/parameter_reference.md#SDLOG_BACKEND) | Logging Backend (bitmask). Setting a bit enables the corresponding backend. If no backend is selected, the logger is disabled.<br />- bit `0`: SD card logging.</br >- bit `1`: Mavlink logging.
| [SDLOG_MODE](../advanced_config/parameter_reference.md#SDLOG_MODE) | Logging Mode. Defines when logging starts and stops.<br />- `-1`: Logging disabled.<br />- `0`: Log when armed until disarm (default).<br />- `1`: Log from boot until disarm.<br />- `2`: Log from boot until shutdown.<br />- `3`: Log based on the [AUX1 RC channel](../advanced_config/parameter_reference.md#RC_MAP_AUX1).<br />- `4`: Log from first armed until shutdown. |
| [SDLOG_PROFILE](../advanced_config/parameter_reference.md#SDLOG_PROFILE) | Logging profile. Use this to enable less common logging/analysis (e.g. for EKF2 replay, high rate logging for PID & filter tuning, thermal temperature calibration). |
| [SDLOG_MISSION](../advanced_config/parameter_reference.md#SDLOG_MISSION) | Create very small additional "Mission Log".<br>This log can _not_ be used with [Flight Review](../log/flight_log_analysis.md#flight-review-online-tool), but is useful when you need a small log for geotagging or regulatory compliance. |
Useful settings for specific cases:
- Raw sensor data for comparison: [SDLOG_MODE=1](../advanced_config/parameter_reference.md#SDLOG_MODE) and [SDLOG_PROFILE=64](../advanced_config/parameter_reference.md#SDLOG_PROFILE).
- Disabling logging altogether: [SDLOG_BACKEND=`0`](../advanced_config/parameter_reference.md#SDLOG_BACKEND)
- Disabling logging altogether: [SDLOG_MODE=`-1`](../advanced_config/parameter_reference.md#SDLOG_MODE)
### Logger module
-37
View File
@@ -316,43 +316,6 @@ For SIH as SITL (no FC):
For specific examples see the `_sihsim_` airframes in [ROMFS/px4fmu_common/init.d-posix/airframes](https://github.com/PX4/PX4-Autopilot/blob/main/ROMFS/px4fmu_common/init.d-posix/airframes/) (SIH as SITL) and [ROMFS/px4fmu_common/init.d/airframes](https://github.com/PX4/PX4-Autopilot/tree/main/ROMFS/px4fmu_common/init.d/airframes) (SIH on FC).
## Controlling Actuators in SIH
:::warning
If you want to control throttling actuators in SIH, make sure to remove propellers for safety.
:::
In some scenarios, it may be useful to control an actuator while running SIH. For example, you might want to verify that winches or grippers are functioning correctly by checking the servo responses.
To enable actuator control in SIH:
1. Configure PWM parameters in the airframe file:
Ensure your airframe file includes the necessary parameters to map PWM outputs to the correct channels.
For example, if a servo is connected to MAIN 3 and you want to map it to AUX1 on your RC, use the following command:
`param set-default PWM_MAIN_FUNC3 407`
You can find a full list of available values for `PWM_MAIN_FUNCn` [here](../advanced_config/parameter_reference.md#PWM_MAIN_FUNC1). In this case, `407` maps the MAIN 3 output to AUX1 on the RC.
Alternatively, you can use the [`PWM_AUX_FUNCn`](../advanced_config/parameter_reference.md#PWM_AUX_FUNC1) parameters.
You may also configure the output as desired:
- Disarmed PWM: ([`PWM_MAIN_DISn`](../advanced_config/parameter_reference.md#PWM_MAIN_DIS1) / [`PWM_AUX_DIS1`](../advanced_config/parameter_reference.md#PWM_AUX_DIS1))
- Minimum PWM ([`PWM_MAIN_MINn`](../advanced_config/parameter_reference.md#PWM_MAIN_MIN1) / [`PWM_AUX_MINn`](../advanced_config/parameter_reference.md#PWM_AUX_MIN1))
- Maximum PWM ([`PWM_MAIN_MAXn`](../advanced_config/parameter_reference.md#PWM_MAIN_MAX1) / [`PWM_AUX_MAXn`](../advanced_config/parameter_reference.md#PWM_AUX_MAX1))
2. Manually start the PWM output driver
For safety, the PWM driver is not started automatically in SIH. To enable it, run the following command in the MAVLink shell:
`pwm_out start`
And to disable it again:
`pwm_out stop`
## Dynamic Models
The dynamic models for the various vehicles are:
+6
View File
@@ -3,6 +3,12 @@
[Rotoye Batmon](https://rotoye.com/batmon/) is a kit for adding smart battery functionality to off-the-shelf Lithium-Ion and LiPo batteries.
It can be purchased as a standalone unit or as part of a factory-assembled smart-battery.
::: info
At time of writing you can only use Batmon by [building a custom branch of PX4](#build-px4-firmware).
Support in the codeline is pending [PR approval](https://github.com/PX4/PX4-Autopilot/pull/16723).
:::
![Rotoye Batmon Board](../../assets/hardware/smart_batteries/rotoye_batmon/smart-battery-rotoye.jpg)
![Pre-assembled Rotoye smart battery](../../assets/hardware/smart_batteries/rotoye_batmon/smart-battery-rotoye-pack.jpg)
+9 -34
View File
@@ -176,6 +176,15 @@ set(msg_files
RateCtrlStatus.msg
RcChannels.msg
RcParameterMap.msg
RoverAttitudeSetpoint.msg
RoverAttitudeStatus.msg
RoverPositionSetpoint.msg
RoverRateSetpoint.msg
RoverRateStatus.msg
RoverSpeedSetpoint.msg
RoverSpeedStatus.msg
RoverSteeringSetpoint.msg
RoverThrottleSetpoint.msg
Rpm.msg
RtlStatus.msg
RtlTimeEstimate.msg
@@ -199,15 +208,6 @@ set(msg_files
SensorsStatusImu.msg
SensorUwb.msg
SensorAirflow.msg
SurfaceVehicleAttitudeSetpoint.msg
SurfaceVehicleAttitudeStatus.msg
SurfaceVehiclePositionSetpoint.msg
SurfaceVehicleRateSetpoint.msg
SurfaceVehicleRateStatus.msg
SurfaceVehicleSpeedSetpoint.msg
SurfaceVehicleSpeedStatus.msg
SurfaceVehicleSteeringSetpoint.msg
SurfaceVehicleThrottleSetpoint.msg
SystemPower.msg
TakeoffStatus.msg
TaskStackInfo.msg
@@ -424,11 +424,9 @@ add_dependencies(uorb_msgs prebuild_targets uorb_headers)
if(CONFIG_LIB_CDRSTREAM)
set(uorb_cdr_idl)
set(uorb_cdr_msg)
set(uorb_cdr_hash)
set(uorb_cdr_idl_uorb)
set(idl_include_path ${PX4_BINARY_DIR}/uORB/idl)
set(idl_out_path ${idl_include_path}/px4/msg)
set(idl_rihs01_out_path ${idl_include_path}/px4)
set(idl_uorb_path ${PX4_BINARY_DIR}/msg/px4/msg)
# Make sure that CycloneDDS has been checkout out
@@ -459,7 +457,6 @@ if(CONFIG_LIB_CDRSTREAM)
configure_file(${msg_file} ${idl_out_path}/${msg}.msg COPYONLY)
list(APPEND uorb_cdr_idl ${idl_out_path}/${msg}.idl)
list(APPEND uorb_cdr_msg ${idl_out_path}/${msg}.msg)
list(APPEND uorb_cdr_hash ${idl_out_path}/${msg}.json)
list(APPEND uorb_cdr_idl_uorb ${idl_uorb_path}/${msg}.h)
endforeach()
@@ -479,25 +476,6 @@ if(CONFIG_LIB_CDRSTREAM)
VERBATIM
)
file(CREATE_LINK ${idl_rihs01_out_path} ${idl_include_path}/px4_msgs SYMBOLIC)
# Generate IDL from .msg using rosidl_adapter
# Note this is a submodule inside PX4 hence no ROS2 installation required
add_custom_command(
OUTPUT ${uorb_cdr_hash}
COMMAND ${CMAKE_COMMAND}
-E env "PYTHONPATH=${PX4_SOURCE_DIR}/src/lib/cdrstream/rosidl/rosidl_adapter:${PX4_SOURCE_DIR}/src/lib/cdrstream/rosidl/rosidl_cli:${PX4_SOURCE_DIR}/src/lib/cdrstream/rosidl/rosidl_parser:${PX4_SOURCE_DIR}/src/lib/cdrstream/rosidl/rosidl_generator_type_description"
${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/src/lib/cdrstream/idl2rihs01.py
--output-dir ${idl_rihs01_out_path}
${uorb_cdr_idl}
DEPENDS
${uorb_cdr_idl}
git_cyclonedds
COMMENT "Generating RIHS01 hashes from IDL"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
VERBATIM
)
# Generate C definitions from IDL
set(CYCLONEDDS_DIR ${PX4_SOURCE_DIR}/src/lib/cdrstream/cyclonedds)
include("${CYCLONEDDS_DIR}/cmake/Modules/Generate.cmake")
@@ -527,7 +505,6 @@ if(CONFIG_LIB_CDRSTREAM)
DEPENDS
uorb_cdrstream
${msg_files}
${uorb_cdr_hash}
${PX4_SOURCE_DIR}/Tools/msg/templates/cdrstream/uorb_idl_header.h.em
${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_helper.py
@@ -557,10 +534,8 @@ if(CONFIG_MODULES_ZENOH)
-f ${msg_files}
-o ${PX4_BINARY_DIR}/src/modules/zenoh/
-e ${PX4_SOURCE_DIR}/Tools/zenoh/templates/zenoh
--rihs ${idl_rihs01_out_path}
DEPENDS
${msg_files}
${uorb_cdr_hash}
${PX4_SOURCE_DIR}/Tools/zenoh/templates/zenoh/uorb_pubsub_factory.hpp.em
${PX4_SOURCE_DIR}/Tools/zenoh/px_generate_zenoh_topic_files.py
COMMENT "Generating Zenoh Topic Code"
@@ -1,4 +1,4 @@
# Surface Vehicle Attitude Setpoint
# Rover Attitude Setpoint
uint64 timestamp # [us] Time since system start
float32 yaw_setpoint # [rad] [@range -inf, inf] [@frame NED] Yaw setpoint
@@ -1,5 +1,5 @@
# Surface Vehicle Attitude Status
# Rover Attitude Status
uint64 timestamp # [us] Time since system start
float32 measured_yaw # [rad] [@range -pi, pi] [@frame NED] Measured yaw
float32 measured_yaw # [rad] [@range -pi, pi] [@frame NED]Measured yaw
float32 adjusted_yaw_setpoint # [rad] [@range -pi, pi] [@frame NED] Yaw setpoint that is being tracked (Applied slew rates)
@@ -1,8 +1,8 @@
# Surface Vehicle Position Setpoint
# Rover Position Setpoint
uint64 timestamp # [us] Time since system start
float32[2] position_ned # [m] [@range -inf, inf] [@frame NED] Target position
float32[2] start_ned # [m] [@range -inf, inf] [@frame NED] [@invalid NaN Defaults to vehicle position] Start position which specifies a line for the rover to track
float32 cruising_speed # [m/s] [@range 0, inf] [@invalid NaN Defaults to maximum speed] Cruising speed
float32 arrival_speed # [m/s] [@range 0, inf] [@invalid NaN Defaults to 0] Speed the vehicle should arrive at the target with
float32 yaw # [rad] [@range -pi,pi] [@frame NED] [@invalid NaN Defaults to vehicle yaw] Omnidirectional only: Specify vehicle yaw during travel
float32 arrival_speed # [m/s] [@range 0, inf] [@invalid NaN Defaults to 0] Speed the rover should arrive at the target with
float32 yaw # [rad] [@range -pi,pi] [@frame NED] [@invalid NaN Defaults to vehicle yaw] Mecanum only: Specify vehicle yaw during travel
@@ -1,4 +1,4 @@
# Surface Vehicle Rate setpoint
# Rover Rate setpoint
uint64 timestamp # [us] Time since system start
float32 yaw_rate_setpoint # [rad/s] [@range -inf, inf] [@frame NED] Yaw rate setpoint
@@ -1,4 +1,4 @@
# Surface Vehicle Rate Status
# Rover Rate Status
uint64 timestamp # [us] Time since system start
float32 measured_yaw_rate # [rad/s] [@range -inf, inf] [@frame NED] Measured yaw rate
@@ -1,5 +1,5 @@
# Surface Vehicle Speed Setpoint
# Rover Speed Setpoint
uint64 timestamp # [us] Time since system start
float32 speed_body_x # [m/s] [@range -inf (Backwards), inf (Forwards)] [@frame Body] Speed setpoint in body x direction
float32 speed_body_y # [m/s] [@range -inf (Left), inf (Right)] [@frame Body] [@invalid NaN If not omnidirectional] Omnidirectional only: Speed setpoint in body y direction
float32 speed_body_y # [m/s] [@range -inf (Left), inf (Right)] [@frame Body] [@invalid NaN If not mecanum] Mecanum only: Speed setpoint in body y direction
@@ -1,9 +1,9 @@
# Surface Vehicle Velocity Status
# Rover Velocity Status
uint64 timestamp # [us] Time since system start
float32 measured_speed_body_x # [m/s] [@range -inf (Backwards), inf (Forwards)] [@frame Body] Measured speed in body x direction
float32 adjusted_speed_body_x_setpoint # [m/s] [@range -inf (Backwards), inf (Forwards)] [@frame Body] Speed setpoint in body x direction that is being tracked (Applied slew rates)
float32 pid_throttle_body_x_integral # [] [@range -1, 1] Integral of the PID for the closed loop controller of the speed in body x direction
float32 measured_speed_body_y # [m/s] [@range -inf (Left), inf (Right)] [@frame Body] [@invalid NaN If not omnidirectional] Omnidirectional only: Measured speed in body y direction
float32 adjusted_speed_body_y_setpoint # [m/s] [@range -inf (Left), inf (Right)] [@frame Body] [@invalid NaN If not omnidirectional] Omnidirectional only: Speed setpoint in body y direction that is being tracked (Applied slew rates)
float32 pid_throttle_body_y_integral # [] [@range -1, 1] [@invalid NaN If not omnidirectional] Omnidirectional only: Integral of the PID for the closed loop controller of the speed in body y direction
float32 measured_speed_body_y # [m/s] [@range -inf (Left), inf (Right)] [@frame Body] [@invalid NaN If not mecanum] Mecanum only: Measured speed in body y direction
float32 adjusted_speed_body_y_setpoint # [m/s] [@range -inf (Left), inf (Right)] [@frame Body] [@invalid NaN If not mecanum] Mecanum only: Speed setpoint in body y direction that is being tracked (Applied slew rates)
float32 pid_throttle_body_y_integral # [] [@range -1, 1] [@invalid NaN If not mecanum] Mecanum only: Integral of the PID for the closed loop controller of the speed in body y direction
@@ -1,4 +1,4 @@
# Surface Vehicle Steering setpoint
# Rover Steering setpoint
uint64 timestamp # [us] Time since system start
float32 normalized_steering_setpoint # [@range -1 (Left), 1 (Right)] [@frame Body] Ackermann: Normalized steering angle, Differential/Omnidirectional: Normalized speed difference between the left and right wheels
float32 normalized_steering_setpoint # [@range -1 (Left), 1 (Right)] [@frame Body] Ackermann: Normalized steering angle, Differential/Mecanum: Normalized speed difference between the left and right wheels
@@ -1,5 +1,5 @@
# Surface Vehicle Throttle setpoint
# Rover Throttle setpoint
uint64 timestamp # [us] Time since system start
float32 throttle_body_x # [] [@range -1 (Backwards), 1 (Forwards)] [@frame Body] Throttle setpoint along body X axis
float32 throttle_body_y # [] [@range -1 (Left), 1 (Right)] [@frame Body] [@invalid NaN If not omnidirectional] Omnidirectional only: Throttle setpoint along body Y axis
float32 throttle_body_y # [] [@range -1 (Left), 1 (Right)] [@frame Body] [@invalid NaN If not mecanum] Mecanum only: Throttle setpoint along body Y axis
@@ -1,14 +0,0 @@
# Arming check request.
#
# Broadcast message to request arming checks be reported by all registered components, such as external ROS 2 navigation modes.
# All registered components should respond with an ArmingCheckReply message that indicates their current mode requirements, and any arming failure information.
# The request is sent regularly, even while armed, so that the FMU always knows the current arming state for external modes, and can forward it to ground stations.
#
# The reply will include the published request_id, allowing correlation of all arming check information for a particular request.
# The reply will also include the registration_id for each external component, provided to it during the registration process (RegisterExtComponentReply).
uint32 MESSAGE_VERSION = 0
uint64 timestamp # [us] Time since system start.
uint8 request_id # Id of this request. Allows correlation with associated ArmingCheckReply messages.
@@ -8,7 +8,6 @@
#include "translation_airspeed_validated_v1.h"
#include "translation_arming_check_reply_v1.h"
#include "translation_arming_check_request_v1.h"
#include "translation_battery_status_v1.h"
#include "translation_event_v1.h"
#include "translation_home_position_v1.h"
@@ -1,36 +0,0 @@
/****************************************************************************
* Copyright (c) 2025 PX4 Development Team.
* SPDX-License-Identifier: BSD-3-Clause
****************************************************************************/
#pragma once
// Translate ArmingCheckRequest v0 <--> v1
#include <px4_msgs_old/msg/arming_check_request_v0.hpp>
#include <px4_msgs/msg/arming_check_request.hpp>
class ArmingCheckRequestV1Translation {
public:
using MessageOlder = px4_msgs_old::msg::ArmingCheckRequestV0;
static_assert(MessageOlder::MESSAGE_VERSION == 0);
using MessageNewer = px4_msgs::msg::ArmingCheckRequest;
static_assert(MessageNewer::MESSAGE_VERSION == 1);
static constexpr const char* kTopic = "/fmu/out/arming_check_request";
static void fromOlder(const MessageOlder &msg_older, MessageNewer &msg_newer) {
msg_newer.timestamp = msg_older.timestamp;
msg_newer.request_id = msg_older.request_id;
msg_newer.valid_registrations_mask = 0xffffffff;
}
static void toOlder(const MessageNewer &msg_newer, MessageOlder &msg_older) {
msg_older.timestamp = msg_newer.timestamp;
msg_older.request_id = msg_newer.request_id;
}
};
REGISTER_TOPIC_TRANSLATION_DIRECT(ArmingCheckRequestV1Translation);
+1 -3
View File
@@ -7,10 +7,8 @@
# The reply will include the published request_id, allowing correlation of all arming check information for a particular request.
# The reply will also include the registration_id for each external component, provided to it during the registration process (RegisterExtComponentReply).
uint32 MESSAGE_VERSION = 1
uint32 MESSAGE_VERSION = 0
uint64 timestamp # [us] Time since system start.
uint8 request_id # Id of this request. Allows correlation with associated ArmingCheckReply messages.
uint32 valid_registrations_mask # Bitmask of valid registration ID's (the bit is also cleared if flagged as unresponsive)
@@ -1,7 +1,7 @@
#! /bin/sh
#
# Bootloader upgrade
# Bootloader upgrade (ROMFS)
#
if param compare -s SYS_BL_UPDATE 1
then
@@ -847,8 +847,6 @@ static flash_error_t file_read_and_program(const uavcan_Path_t *fw_path, uint8_t
request.offset += length;
bootloader.percentage_done = (request.offset / a_percent);
watchdog_pet();
} while (request.offset < fw_image_size &&
length == sizeof(response.data) &&
flash_status == FLASH_OK);
+2
View File
@@ -2,9 +2,11 @@ menu "Distance sensors"
menuconfig COMMON_DISTANCE_SENSOR
bool "Common distance sensor's"
default n
select DRIVERS_DISTANCE_SENSOR_CM8JL65
select DRIVERS_DISTANCE_SENSOR_LIGHTWARE_LASER_I2C
select DRIVERS_DISTANCE_SENSOR_LIGHTWARE_LASER_SERIAL
select DRIVERS_DISTANCE_SENSOR_LL40LS
select DRIVERS_DISTANCE_SENSOR_TERARANGER
select DRIVERS_DISTANCE_SENSOR_TF02PRO
select DRIVERS_DISTANCE_SENSOR_TFMINI
select DRIVERS_DISTANCE_SENSOR_ULANDING_RADAR
-1
View File
@@ -254,7 +254,6 @@
#define DRV_INS_DEVTYPE_ILABS 0xE9
#define DRV_INS_DEVTYPE_MICROSTRAIN 0xEA
#define DRV_INS_DEVTYPE_BAHRS 0xEB
#define DRV_DEVTYPE_UNUSED 0xff
+1 -1
View File
@@ -16,7 +16,7 @@ parameters:
sure to set this high enough so that the motors are always spinning while
armed.
type: float
unit: norm
unit: '%'
min: 0
max: 1
decimal: 2
-4
View File
@@ -759,10 +759,6 @@ GPS::run()
ubx_mode = GPSDriverUBX::UBXMode::RoverWithStaticBaseUart2;
break;
case 6:
ubx_mode = GPSDriverUBX::UBXMode::GroundControlStation;
break;
default:
break;
-2
View File
@@ -94,7 +94,6 @@ PARAM_DEFINE_INT32(GPS_SAT_INFO, 0);
* F9P units are connected to each other.
* Modes 3 and 4 only require UART1 on each F9P connected to the Autopilot or Can Node. UART RX DMA is required.
* RTK is still possible with this setup.
* Mode 6 is intended for use with a ground control station (not necessarily an RTK correction base).
*
* @min 0
* @max 1
@@ -104,7 +103,6 @@ PARAM_DEFINE_INT32(GPS_SAT_INFO, 0);
* @value 3 Heading (Rover With Moving Base UART1 Connected to Autopilot Or Can Node At 921600)
* @value 4 Moving Base (Moving Base UART1 Connected to Autopilot Or Can Node At 921600)
* @value 5 Rover with Static Base on UART2 (similar to Default, except coming in on UART2)
* @value 6 Ground Control Station (UART2 outputs NMEA)
*
* @reboot_required true
* @group GPS
-1
View File
@@ -5,7 +5,6 @@ menu "Inertial Navigation Systems (INS)"
select DRIVERS_INS_VECTORNAV
select DRIVERS_INS_ILABS
select DRIVERS_INS_MICROSTRAIN
select DRIVERS_INS_EULERNAV_BAHRS
---help---
Enable default set of INS sensors
rsource "*/Kconfig"
@@ -1,44 +0,0 @@
############################################################################
#
# Copyright (c) 2025 PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name PX4 nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
px4_add_module(
MODULE drivers__ins__eulerav_bahrs
MAIN eulernav_bahrs
INCLUDES
bahrs
SRCS
eulernav_bahrs_main.cpp
eulernav_driver.cpp
eulernav_driver.h
DEPENDS
ringbuffer
)
-5
View File
@@ -1,5 +0,0 @@
menuconfig DRIVERS_INS_EULERNAV_BAHRS
bool "eulernav_bahrs"
default n
---help---
Enable support for EULER-NAV Baro-Inertial AHRS
@@ -1,371 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2025 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/**
* The header is a modified version of a header from this repo:
* https://github.com/euler-nav/bahrs-oss
*
* Copyright 2023 AMS Advanced Air Mobility Sensors UG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include <stdint.h>
#define PROTOCOL_WORD_LEN (4)
#define PADDING_SIZE(SPayloadType) (PROTOCOL_WORD_LEN - ((sizeof(SMessageHeader) + sizeof(SPayloadType)) % PROTOCOL_WORD_LEN))
#define BIT_VALID_HEIGHT (0x01)
#define BIT_VALID_VELOCITY_DOWN (0x02)
#define BIT_VALID_ROLL (0x04)
#define BIT_VALID_PITCH (0x08)
#define BIT_VALID_MAGNETIC_HEADING (0x10)
#define BIT_VALID_SPECIFIC_FORCE_X (0x01)
#define BIT_VALID_SPECIFIC_FORCE_Y (0x02)
#define BIT_VALID_SPECIFIC_FORCE_Z (0x04)
#define BIT_VALID_ANGULAR_RATE_X (0x08)
#define BIT_VALID_ANGULAR_RATE_Y (0x10)
#define BIT_VALID_ANGULAR_RATE_Z (0x20)
/**
* @brief The class that describes and implements the BAHRS serial protocol.
*/
class CSerialProtocol
{
public:
static constexpr uint8_t uMarker1_ { 0x4E }; ///< Sync byte 1, symbol 'N'
static constexpr uint8_t uMarker2_ { 0x45 }; ///< Sync char 2, symbol 'E'
static constexpr uint16_t uVersion_ { 2U }; ///< Protocol version
static constexpr float skfSpecificForceScale_ { 1.495384e-3F }; ///< Integer to float, +-5g range
static constexpr float skfAngularRateScale_ { 1.597921e-4F }; ///< Integer to float, +-300 deg/s range
static constexpr float skfHeightScale_ { 0.16784924F }; ///< Integer to float, -1000 to 10000 m range
static constexpr float skfHeighOffset_ { 1000.0F }; ///< An offset to convert unsigned integer to float
static constexpr float skfVelocityDownScale_ { 9.155413e-3F }; ///< Integer to float, -300 to 300 m/s range
static constexpr float skfAngleScale_ { 9.587526e-5F }; ///< Integer to float, -pi to pi or 0 to 2 pi range
// Signal ranges
static constexpr float skfMaxHeight_ { 10000.0F };
static constexpr float skfMinHeight_ { -1000.0F };
static constexpr float skfMaxVelocityDown_ { 300.0F };
static constexpr float skfMinVelocityDown_ { -300.0F };
enum class EMessageIds : uint8_t {
eInvalid = 0x00, ///< Invalid
eInertialData = 0x01, ///< Inertial data message
eNavigationData = 0x02, ///< Navigation data message
eAccuracy = 0x03, ///< Attitude accuracy information
eTimeOfNavigationData = 0x04, ///< "Time of navigation data" message
eTimeOfInertialData = 0x05, ///< "Time of inertial data" message
eTimeOfSyncPulse = 0x06, ///< "Time of the latest sync pulse" message
eSoftwareVersion = 0x0F, ///< "Software version" message
eDebugEventWriteToPort = 0xC0, ///< Debug information: SWC port data
eDebugEventRunnableCall = 0xC1, ///< Debug information: SWC API call
eTypeOpenDiagnostic = 0xF0, ///< Request to enter diagnostics mode
eTypeCloseDiagnostic = 0xF1, ///< Request to exit diagnostics mode
eTypeReadNVMPage = 0xF2, ///< Request to read NVM page
eTypeNVMPageData = 0xF3, ///< A message with NVM page data
eTypeAccept = 0xFF ///< Acknowledgment of diagnostics message reception
};
typedef uint32_t CrcType_t;
#pragma pack(push, 1)
/**
* @brief Message header struct.
*/
struct SMessageHeader {
uint8_t uMarker1_ { 0x4E };
uint8_t uMarker2_ { 0x45 };
uint16_t uVersion_ { CSerialProtocol::uVersion_ };
uint8_t uMsgType_ { 0U };
};
/**
* @brief Inertial data message payload.
*/
struct SInertialData {
uint8_t uSequenceCounter_ { 0U };
int16_t iSpecificForceX_ { 0 };
int16_t iSpecificForceY_ { 0 };
int16_t iSpecificForceZ_ { 0 };
int16_t iAngularRateX_ { 0 };
int16_t iAngularRateY_ { 0 };
int16_t iAngularRateZ_ { 0 };
uint8_t uValidity_ { 0U };
};
/**
* @brief Payload of the time of inertial data message.
*/
struct STimeOfInertialData {
uint8_t uSequenceCounter_ { 0U };
uint8_t uInertialDataSequenceCounter_ { 0U };
uint64_t uTimestampUs_ { 0U };
};
/**
* @brief Navigation data message payload.
*/
struct SNavigationData {
uint8_t uSequenceCounter_ { 0U };
uint16_t uPressureHeight_ { 0 };
int16_t iVelocityDown_ { 0 };
int16_t iRoll_ { 0 };
int16_t iPitch_ { 0 };
uint16_t uMagneticHeading_ { 0U };
uint8_t uValidity_ { 0 };
};
/**
* @brief Payload of the "time of navigation data" message.
*/
struct STimeOfNavigationData {
uint8_t uSequenceCounter_ { 0U };
uint8_t uNavigationDataSequenceCounter_ { 0U };
uint64_t uTimestampUs_ { 0U };
};
/**
* @brief Accuracy message payload.
*/
struct SAccuracyData {
uint8_t uSequenceCounter_ { 0U };
uint16_t uAttitudeStdN_ { 0U };
uint16_t uAttitudeStdE_ { 0U };
uint16_t uMagneticHeadingStd_ { 0U };
uint64_t uTimestampUs_ { 0U };
};
/**
* @brief Payload of the "time of the latest pulse" message.
*/
struct STimeOfLatestSyncPulse {
uint8_t uSequenceCounter_ { 0U };
uint64_t uTimestampUs_ { 0U };
};
/**
* @brief Payload of the "software version" message.
*/
struct SSoftwareVersionData {
char acProjectCode_[3] { '\0', '\0', '\0' };
uint16_t uMajor_ { 0U };
uint16_t uMinor_ { 0U };
};
/**
* @brief Partial data of the "write to port event".
* The struct does not include a variable size array of data written to a port.
*/
struct SWriteToPortEventPartialData {
uint8_t uPortId_ { 0U };
uint64_t uTimestampUs_ { 0U };
uint16_t uDataLen_ { 0U };
};
/**
* @brief Debug information on runnable call.
*/
struct SRunnableCallEventData {
uint8_t uRunnableId_ { 0U };
uint64_t uTimestampUs_ { 0U };
};
/**
* @brief Inertial data message.
*/
struct SInertialDataMessage {
SMessageHeader oHeader_ { CSerialProtocol::uMarker1_,
CSerialProtocol::uMarker2_,
CSerialProtocol::uVersion_,
static_cast<uint8_t>(EMessageIds::eInertialData) };
SInertialData oInertialData_;
uint8_t auPadding_[PADDING_SIZE(SInertialData)];
CrcType_t uCrc_ { 0U };
};
/**
* @brief Time of inertial data message.
*/
struct STimeOfInertialDataMessage {
SMessageHeader oHeader_ { CSerialProtocol::uMarker1_,
CSerialProtocol::uMarker2_,
CSerialProtocol::uVersion_,
static_cast<uint8_t>(EMessageIds::eTimeOfInertialData) };
STimeOfInertialData oTimeOfInertialData_;
uint8_t auPadding_[PADDING_SIZE(STimeOfInertialData)];
CrcType_t uCrc_ { 0U };
};
/**
* @brief Navigation data message.
*/
struct SNavigationDataMessage {
SMessageHeader oHeader_ { CSerialProtocol::uMarker1_,
CSerialProtocol::uMarker2_,
CSerialProtocol::uVersion_,
static_cast<uint8_t>(EMessageIds::eNavigationData) };
SNavigationData oNavigationData_;
uint8_t auPadding_[PADDING_SIZE(SNavigationData)];
CrcType_t uCrc_ { 0U };
};
/**
* @brief Navigation data accuracy message.
*/
struct SAccuracyDataMessage {
SMessageHeader oHeader_ { CSerialProtocol::uMarker1_,
CSerialProtocol::uMarker2_,
CSerialProtocol::uVersion_,
static_cast<uint8_t>(EMessageIds::eAccuracy) };
SAccuracyData oAccuracy_;
uint8_t auPadding_[PADDING_SIZE(SAccuracyData)];
CrcType_t uCrc_ { 0U };
};
/**
* @brief Time of navigation data message.
*/
struct STimeOfNavigationDataMessage {
SMessageHeader oHeader_ { CSerialProtocol::uMarker1_,
CSerialProtocol::uMarker2_,
CSerialProtocol::uVersion_,
static_cast<uint8_t>(EMessageIds::eTimeOfNavigationData) };
STimeOfNavigationData oTimeOfNavigationData_;
uint8_t auPadding_[PADDING_SIZE(STimeOfNavigationData)];
CrcType_t uCrc_ { 0U };
};
/**
* @brief Time of the latest sync pulse message.
*/
struct STimeOfLatestSyncPulseMessage {
SMessageHeader oHeader_ { CSerialProtocol::uMarker1_,
CSerialProtocol::uMarker2_,
CSerialProtocol::uVersion_,
static_cast<uint8_t>(EMessageIds::eTimeOfSyncPulse) };
STimeOfLatestSyncPulse oTimeOfLatestSyncPulse_;
uint8_t auPadding_[PADDING_SIZE(STimeOfLatestSyncPulse)];
CrcType_t uCrc_ { 0U };
};
/**
* @brief Software version message.
*/
struct SSoftwareVersionMessage {
SMessageHeader oHeader_ { CSerialProtocol::uMarker1_,
CSerialProtocol::uMarker2_,
CSerialProtocol::uVersion_,
static_cast<uint8_t>(EMessageIds::eSoftwareVersion) };
SSoftwareVersionData oSoftwareVersion_;
uint8_t auPadding_[PADDING_SIZE(SSoftwareVersionData)];
CrcType_t uCrc_ { 0U };
};
/**
* @brief A debug message with runnable call data.
*/
struct SRunnableCallEventDebugMessage {
SMessageHeader oHeader_{ CSerialProtocol::uMarker1_,
CSerialProtocol::uMarker2_,
CSerialProtocol::uVersion_,
static_cast<uint8_t>(EMessageIds::eDebugEventRunnableCall) };
SRunnableCallEventData oRunnableCallData_;
uint8_t auPadding_[PADDING_SIZE(oRunnableCallData_)];
CrcType_t uCrc_{ 0U };
};
/**
* @brief Diagnostic Mode Messages
****************************************************************************/
/**
* @brief Diagnostic message: Page request from NVM.
*/
struct SPacketReadNVMPage {
SMessageHeader oHeader_;
uint8_t uPageNumber { 0U };
CrcType_t uCrc32 { 0U };
};
/**
* @brief Diagnostic message: confirmation of request processing by the device.
*/
struct SPacketReceiveConfirmation {
SMessageHeader oHeader_ { CSerialProtocol::uMarker1_,
CSerialProtocol::uMarker2_,
CSerialProtocol::uVersion_,
static_cast<uint8_t>(EMessageIds::eTypeAccept) };
EMessageIds eMessageType; // message type to confirm.
uint8_t uStatus { 0U }; // 0 - OK, other values - error codes
CrcType_t uCrc32 { 0U };
};
#pragma pack(pop)
};
@@ -1,48 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2025 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/**
* @file eulernav_bahrs_main.cpp
* A driver module for EULER-NAV Baro-Inertial AHRS.
*
* @author Fedor Baklanov <fedor.baklanov@euler-nav.com>
*/
#include <px4_platform_common/log.h>
#include "eulernav_driver.h"
extern "C" __EXPORT int eulernav_bahrs_main(int argc, char *argv[])
{
EulerNavDriver::main(argc, argv);
return OK;
}
@@ -1,514 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2025 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#include "eulernav_driver.h"
#include <px4_platform_common/getopt.h>
#include <drivers/drv_sensor.h>
#include <matrix/Quaternion.hpp>
#include <matrix/Euler.hpp>
#include <atmosphere/atmosphere.h>
EulerNavDriver::EulerNavDriver(const char *device_name)
: ModuleParams{nullptr}
, _serial_port{device_name, 115200, ByteSize::EightBits, Parity::None, StopBits::One, FlowControl::Disabled}
, _data_buffer{}
, _px4_accel{DRV_INS_DEVTYPE_BAHRS}
, _px4_gyro{DRV_INS_DEVTYPE_BAHRS}
{
}
EulerNavDriver::~EulerNavDriver()
{
deinitialize();
}
int EulerNavDriver::task_spawn(int argc, char *argv[])
{
int task_id = px4_task_spawn_cmd("bahrs", SCHED_DEFAULT, SCHED_PRIORITY_FAST_DRIVER,
Config::TASK_STACK_SIZE, (px4_main_t)&run_trampoline, argv);
if (task_id < 0) {
_task_id = -1;
PX4_ERR("Failed to spawn task.");
} else {
_task_id = task_id;
}
return (_task_id < 0) ? 1 : 0;
}
EulerNavDriver *EulerNavDriver::instantiate(int argc, char *argv[])
{
int option_index = 1;
const char *option_arg{nullptr};
const char *device_name{nullptr};
while (true) {
int option{px4_getopt(argc, argv, "d:", &option_index, &option_arg)};
if (EOF == option) {
break;
}
switch (option) {
case 'd':
device_name = option_arg;
break;
default:
break;
}
}
auto *instance = new EulerNavDriver(device_name);
if (nullptr != instance) {
instance->initialize();
} else {
PX4_ERR("Failed to initialize EULER-NAV driver.");
}
return instance;
}
int EulerNavDriver::custom_command(int argc, char *argv[])
{
return print_usage("unrecognized command");
}
int EulerNavDriver::print_usage(const char *reason)
{
if (reason) {
PX4_WARN("%s\n", reason);
}
PRINT_MODULE_DESCRIPTION(
R"DESCR_STR(
### Description
Serial bus driver for the EULER-NAV Baro-Inertial AHRS.
### Examples
Attempt to start driver on a specified serial device.
$ eulernav_bahrs start -d /dev/ttyS1
Stop driver
$ eulernav_bahrs stop
)DESCR_STR");
PRINT_MODULE_USAGE_NAME("eulernav_bahrs", "driver");
PRINT_MODULE_USAGE_SUBCATEGORY("ins");
PRINT_MODULE_USAGE_COMMAND_DESCR("start", "Start driver");
PRINT_MODULE_USAGE_PARAM_STRING('d', nullptr, nullptr, "Serial device", false);
PRINT_MODULE_USAGE_COMMAND_DESCR("status", "Print driver status");
PRINT_MODULE_USAGE_COMMAND_DESCR("stop", "Stop driver");
return PX4_OK;
}
int EulerNavDriver::print_status()
{
if (_is_initialized)
{
PX4_INFO("Elapsed time: %llu [us].\n", hrt_elapsed_time(&_statistics.start_time));
PX4_INFO("Total bytes received: %lu.\n", _statistics.total_bytes_received);
PX4_INFO("Inertial messages received: %lu. Navigation messages received: %lu.\n",
_statistics.inertial_message_counter, _statistics.navigation_message_counter);
PX4_INFO("Failed CRC count: %lu.\n", _statistics.crc_failures);
}
else
{
PX4_INFO("Initialization failed. The driver is not running.\n");
}
return PX4_OK;
}
void EulerNavDriver::run()
{
_statistics.start_time = hrt_absolute_time();
while(!should_exit())
{
if (_is_initialized)
{
const auto bytes_read{_serial_port.readAtLeast(_serial_read_buffer, sizeof(_serial_read_buffer),
Config::MIN_BYTES_TO_READ, Config::SERIAL_READ_TIMEOUT_MS)};
_statistics.total_bytes_received += bytes_read;
if (bytes_read > 0)
{
if (!_data_buffer.push_back(_serial_read_buffer, bytes_read))
{
PX4_ERR("No space in data buffer");
}
}
processDataBuffer();
}
else
{
// The driver failed to initialize in the instantiate() method, so we exit the loop.
request_stop();
}
}
}
void EulerNavDriver::initialize()
{
if (!_is_initialized)
{
if (_serial_port.open())
{
PX4_INFO("Serial port opened successfully.");
_is_initialized = true;
}
else
{
PX4_ERR("Failed to open serial port");
}
if (_is_initialized)
{
if (!_data_buffer.allocate(Config::DATA_BUFFER_SIZE))
{
PX4_ERR("Failed to allocate data buffer");
_is_initialized = false;
}
}
if (_is_initialized)
{
_attitude_pub.advertise();
_barometer_pub.advertise();
}
}
}
void EulerNavDriver::deinitialize()
{
if (_serial_port.isOpen())
{
_serial_port.close();
}
_data_buffer.deallocate();
_attitude_pub.unadvertise();
_barometer_pub.unadvertise();
_is_initialized = false;
}
void EulerNavDriver::processDataBuffer()
{
static_assert(Config::MIN_MESSAGE_LENGTH >= (sizeof(CSerialProtocol::SMessageHeader) + sizeof(CSerialProtocol::CrcType_t)));
using EMessageIds = CSerialProtocol::EMessageIds;
while (_data_buffer.space_used() >= Config::MIN_MESSAGE_LENGTH)
{
if (!_next_message_info.is_detected)
{
_next_message_info.is_detected = findNextMessageHeader(_data_buffer);
if (!_next_message_info.is_detected)
{
// No message header found, wait for more bytes to arrive.
break;
}
if (!retrieveProtocolVersionAndMessageType(_data_buffer, _next_message_info.protocol_version, _next_message_info.message_code))
{
_next_message_info.is_detected = false;
}
}
if (_next_message_info.is_detected)
{
static_assert(sizeof(CSerialProtocol::SMessageHeader) < Config::MIN_MESSAGE_LENGTH);
const EMessageIds message_id{static_cast<EMessageIds>(_next_message_info.message_code)};
const int32_t message_length{getMessageLength(message_id)};
if ((message_length < 0) || (message_length < Config::MIN_MESSAGE_LENGTH) ||
(message_length > static_cast<int32_t>(sizeof(_message_storage))) || ((message_length % sizeof(uint32_t)) != 0U))
{
// The message is unknown, not supported, or does not fit into the temporary storage.
_next_message_info.is_detected = false;
continue;
}
const int32_t bytes_to_retrieve{message_length - static_cast<int32_t>(sizeof(CSerialProtocol::SMessageHeader))};
if (static_cast<int32_t>(_data_buffer.space_used()) < bytes_to_retrieve)
{
// Do nothing and wait for more bytes to arrive.
break;
}
// Get message from the data buffer
uint8_t* bytes{reinterpret_cast<uint8_t*>(_message_storage)};
bytes[0] = CSerialProtocol::uMarker1_;
bytes[1] = CSerialProtocol::uMarker2_;
bytes[2] = reinterpret_cast<uint8_t*>(&_next_message_info.protocol_version)[0];
bytes[3] = reinterpret_cast<uint8_t*>(&_next_message_info.protocol_version)[1];
bytes[4] = _next_message_info.message_code;
if (static_cast<size_t>(bytes_to_retrieve) == _data_buffer.pop_front(bytes + sizeof(CSerialProtocol::SMessageHeader), bytes_to_retrieve))
{
const uint32_t message_length_in_words{message_length / sizeof(uint32_t)};
const uint32_t actual_crc{crc32(_message_storage, message_length_in_words - 1)};
const uint32_t expected_crc = _message_storage[message_length_in_words - 1];
if (expected_crc != actual_crc)
{
++_statistics.crc_failures;
}
else
{
decodeMessageAndPublishData(bytes, message_id);
}
}
_next_message_info.is_detected = false;
}
}
}
bool EulerNavDriver::findNextMessageHeader(Ringbuffer& buffer)
{
bool result{false};
while (buffer.space_used() >= sizeof(CSerialProtocol::SMessageHeader))
{
uint8_t sync_byte{0U};
if ((1 == buffer.pop_front(&sync_byte, 1)) && (CSerialProtocol::uMarker1_ == sync_byte))
{
sync_byte = 0U;
if ((1 == buffer.pop_front(&sync_byte, 1)) && (CSerialProtocol::uMarker2_ == sync_byte))
{
result = true;
break;
}
}
}
return result;
}
bool EulerNavDriver::retrieveProtocolVersionAndMessageType(Ringbuffer& buffer, uint16_t& protocol_ver, uint8_t& message_code)
{
bool status{true};
auto bytes_to_pop{sizeof(protocol_ver)};
// Note: BAHRS uses little endian
if (bytes_to_pop != buffer.pop_front(reinterpret_cast<uint8_t*>(&protocol_ver), bytes_to_pop))
{
status = false;
}
if (status)
{
bytes_to_pop = 1;
if (bytes_to_pop != buffer.pop_front(&message_code, bytes_to_pop))
{
status = false;
}
}
return status;
}
void EulerNavDriver::decodeMessageAndPublishData(const uint8_t* data, CSerialProtocol::EMessageIds messsage_id)
{
switch (messsage_id)
{
case CSerialProtocol::EMessageIds::eInertialData:
handleInertialDataMessage(data);
break;
case CSerialProtocol::EMessageIds::eNavigationData:
handleNavigationDataMessage(data);
break;
default:
break;
}
}
void EulerNavDriver::handleInertialDataMessage(const uint8_t* data)
{
const CSerialProtocol::SInertialDataMessage* imu_msg{reinterpret_cast<const CSerialProtocol::SInertialDataMessage*>(data)};
if (nullptr != imu_msg)
{
const auto& imu_data{imu_msg->oInertialData_};
const bool accel_valid{((imu_data.uValidity_ & BIT_VALID_SPECIFIC_FORCE_X) > 0) &&
((imu_data.uValidity_ & BIT_VALID_SPECIFIC_FORCE_Y) > 0) &&
((imu_data.uValidity_ & BIT_VALID_SPECIFIC_FORCE_Z) > 0)};
const bool gyro_valid{((imu_data.uValidity_ & BIT_VALID_ANGULAR_RATE_X) > 0) &&
((imu_data.uValidity_ & BIT_VALID_ANGULAR_RATE_Y) > 0) &&
((imu_data.uValidity_ & BIT_VALID_ANGULAR_RATE_Z) > 0)};
const auto time = hrt_absolute_time();
if (accel_valid)
{
const float accel_x{CSerialProtocol::skfSpecificForceScale_ * static_cast<float>(imu_data.iSpecificForceX_)};
const float accel_y{CSerialProtocol::skfSpecificForceScale_ * static_cast<float>(imu_data.iSpecificForceY_)};
const float accel_z{CSerialProtocol::skfSpecificForceScale_ * static_cast<float>(imu_data.iSpecificForceZ_)};
_px4_accel.update(time, accel_x, accel_y, accel_z);
}
if (gyro_valid)
{
const float gyro_x{CSerialProtocol::skfAngularRateScale_ * static_cast<float>(imu_data.iAngularRateX_)};
const float gyro_y{CSerialProtocol::skfAngularRateScale_ * static_cast<float>(imu_data.iAngularRateY_)};
const float gyro_z{CSerialProtocol::skfAngularRateScale_ * static_cast<float>(imu_data.iAngularRateZ_)};
_px4_gyro.update(time, gyro_x, gyro_y, gyro_z);
}
++_statistics.inertial_message_counter;
}
}
void EulerNavDriver::handleNavigationDataMessage(const uint8_t* data)
{
const CSerialProtocol::SNavigationDataMessage* nav_msg{reinterpret_cast<const CSerialProtocol::SNavigationDataMessage*>(data)};
if (nullptr != nav_msg)
{
const auto& nav_data{nav_msg->oNavigationData_};
const bool roll_valid{(nav_data.uValidity_ & BIT_VALID_ROLL) > 0};
const bool pitch_valid{(nav_data.uValidity_ & BIT_VALID_PITCH) > 0};
const bool yaw_valid{(nav_data.uValidity_ & BIT_VALID_MAGNETIC_HEADING) > 0};
const auto time{hrt_absolute_time()};
if (roll_valid && pitch_valid && yaw_valid)
{
const float roll{CSerialProtocol::skfAngleScale_ * static_cast<float>(nav_data.iRoll_)};
const float pitch{CSerialProtocol::skfAngleScale_ * static_cast<float>(nav_data.iPitch_)};
const float yaw{CSerialProtocol::skfAngleScale_ * static_cast<float>(nav_data.uMagneticHeading_)};
const matrix::Quaternionf quat{matrix::Eulerf{roll, pitch, yaw}};
px4::msg::VehicleAttitude attitude{};
attitude.q[0] = quat(0);
attitude.q[1] = quat(1);
attitude.q[2] = quat(2);
attitude.q[3] = quat(3);
attitude.timestamp = time;
attitude.timestamp_sample = time;
_attitude_pub.publish(attitude);
}
const bool height_valid{(nav_data.uValidity_ & BIT_VALID_HEIGHT) > 0};
if (height_valid)
{
const float height{(CSerialProtocol::skfHeightScale_ * static_cast<float>(nav_data.uPressureHeight_)) - CSerialProtocol::skfHeighOffset_};
px4::msg::SensorBaro pressure{};
pressure.pressure = atmosphere::getPressureFromAltitude(height);
// EULER-NAV Baro-Inertial AHRS provides height estimate from a Kalman filter. It has got low noise and resolution
// of about 17 cm. It causes PX4 autopilot to mistakenly report that pressure signal is stale. In order to prevent
// the false alarms we add a small noise to the received height data.
if (_statistics.navigation_message_counter % 2U == 0)
{
pressure.pressure += 0.01F;
}
pressure.timestamp = time;
pressure.timestamp_sample = time;
pressure.device_id = DRV_INS_DEVTYPE_BAHRS;
pressure.temperature = NAN;
_barometer_pub.publish(pressure);
}
++_statistics.navigation_message_counter;
}
}
int32_t EulerNavDriver::getMessageLength(CSerialProtocol::EMessageIds messsage_id)
{
int message_length{-1};
switch (messsage_id)
{
case CSerialProtocol::EMessageIds::eInertialData:
message_length = sizeof(CSerialProtocol::SInertialDataMessage);
break;
case CSerialProtocol::EMessageIds::eNavigationData:
message_length = sizeof(CSerialProtocol::SNavigationDataMessage);
break;
default:
break;
}
return message_length;
}
uint32_t EulerNavDriver::crc32(const uint32_t* buffer, size_t length)
{
uint32_t crc = 0xFFFFFFFF;
for (size_t i = 0; i < length; ++i)
{
crc = crc ^ buffer[i];
for (uint8_t j = 0; j < 32; j++)
{
if (crc & 0x80000000)
{
crc = (crc << 1) ^ 0x04C11DB7;
}
else
{
crc = (crc << 1);
}
}
}
return crc;
}
@@ -1,174 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2025 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#pragma once
#include <px4_platform_common/module.h>
#include <px4_platform_common/module_params.h>
#include <px4_platform_common/Serial.hpp>
#include <uORB/PublicationMulti.hpp>
#include <uORB/topics/vehicle_attitude.h>
#include <lib/drivers/accelerometer/PX4Accelerometer.hpp>
#include <lib/drivers/gyroscope/PX4Gyroscope.hpp>
#include <uORB/topics/sensor_baro.h>
#include <Ringbuffer.hpp>
#include <containers/Array.hpp>
#include "CSerialProtocol.h"
class EulerNavDriver : public ModuleBase<EulerNavDriver>, public ModuleParams
{
public:
/// @brief Class constructor
/// @param device_name Serial port to open
EulerNavDriver(const char *device_name);
~EulerNavDriver();
/// @brief Required by ModuleBase
static int task_spawn(int argc, char *argv[]);
/// @brief Required by ModuleBase
static EulerNavDriver *instantiate(int argc, char *argv[]);
/// @brief Required by ModuleBase
static int custom_command(int argc, char *argv[]);
/// @brief Required by ModuleBase
static int print_usage(const char *reason = nullptr);
/// @brief Overload of the method from the ModuleBase
int print_status() final;
/// @brief The main loop of the task.
void run() final;
private:
/// @brief Driver performance indicators
class Statistics
{
public:
uint32_t total_bytes_received{0U}; ///< Total number of received bytes
uint32_t inertial_message_counter{0U}; ///< Total number of received inertial data messages
uint32_t navigation_message_counter{0U}; ///< Total number of received navigation messages
uint32_t crc_failures{0U}; ///< CRC failure counter
hrt_abstime start_time{0U}; ///< Driver start time, [us]
};
/// @brief Configuration constants
class Config
{
public:
static constexpr uint32_t TASK_STACK_SIZE{2048}; ///< Driver task stack size
static constexpr uint32_t SERIAL_READ_BUFFER_SIZE{128}; ///< Buffer size for serial port read operations
static constexpr uint32_t MIN_BYTES_TO_READ{16}; ///< Minimum number of bytes to wait for when reading from a serial port
static constexpr uint32_t SERIAL_READ_TIMEOUT_MS{5}; ///< A timeout for serial port read operation
static constexpr uint32_t DATA_BUFFER_SIZE{512}; ///< Size of a ring buffer for storing RX data stream
static constexpr int32_t MIN_MESSAGE_LENGTH{12}; ///< Min length of a valid message. 5 bytes header + 4 bytes CRC + padding to 12 (multiple of 32 bit words)
};
/// @brief An object for grouping message-related attributes
class NextMessageInfo
{
public:
bool is_detected{false}; ///< A flag to indicate that the next message header was detected
uint16_t protocol_version{0U}; ///< Protocol version retrieved from the next message header
uint8_t message_code{0U}; ///< Message code retrieved from the next message header
};
/// @brief Perform initialization
/// If the driver is not initialized, the function does the following:
/// 1. Opens serial port
/// 2. Allocates a ring buffer for RX data stream
/// 3. Cleans up if any of the previous operations fails
/// 4. Sets the "is initialized" flag to true on success
void initialize();
/// @brief De-initialize
/// The function does the following:
/// 1. Close the serial port, if it is opened
/// 2. Deallocates the ring buffer
/// 3. Resets the "is initialized" flag to false
void deinitialize();
/// @brief Process data in the ring buffer.
/// Extracts and parses protocol messages.
void processDataBuffer();
/// @brief Searches the ring buffer for sync bytes.
/// @param buffer Ring buffer to search
/// @return True if sync bytes found, false if the number of bytes remaining in the buffer is less then message header length.
static bool findNextMessageHeader(Ringbuffer &buffer);
/// @brief Get protocol version and message code from the ring buffer.
/// @param buffer The buffer to process
/// @param protocol_ver Output protocol version
/// @param message_code Output message code
/// @return True on success, false on failure
static bool retrieveProtocolVersionAndMessageType(Ringbuffer &buffer, uint16_t &protocol_ver, uint8_t &message_code);
/// @brief Decode a message from BAHRS and publish its content.
/// @param data An array of message bytes
/// @param messsage_id Message ID
void decodeMessageAndPublishData(const uint8_t *data, CSerialProtocol::EMessageIds messsage_id);
/// @brief Decode and publish IMU data.
/// @param data Inertial message data bytes
void handleInertialDataMessage(const uint8_t *data);
/// @brief Decode and publish vehicle attitude and pressure height.
/// @param data Navigation message data bytes
void handleNavigationDataMessage(const uint8_t *data);
/// @brief Get message length by message ID
/// @param messsage_id Query message ID
/// @return Message length, or -1 if the message ID is unknown or not supported.
static int32_t getMessageLength(CSerialProtocol::EMessageIds messsage_id);
/// @brief Perform CRC
/// @param buf Data buffer pointer
/// @param len Number of words to include in the CRC.
/// @return CRC value
static uint32_t crc32(const uint32_t *buf, size_t len);
device::Serial _serial_port; ///< Serial port object to read data from
Ringbuffer _data_buffer; ///< A buffer for RX data stream
uint8_t _serial_read_buffer[Config::SERIAL_READ_BUFFER_SIZE]; ///< A buffer for serial port read operation
uint32_t _message_storage[8]; ///< A temporary storage for BAHRS messages being extracted
NextMessageInfo _next_message_info{}; ///< Attributes of the next message detected in the data buffer
Statistics _statistics{}; ///< Driver performance indicators
bool _is_initialized{false}; ///< Initialization flag
PX4Accelerometer _px4_accel; ///< Accelerometer sensor object for publishing acceleration data
PX4Gyroscope _px4_gyro; ///< Gyroscope sensor object for publishing angular rate data
uORB::PublicationMulti<px4::msg::VehicleAttitude> _attitude_pub{ORB_ID(vehicle_attitude)}; ///< Vehicle attitude publisher
uORB::PublicationMulti<px4::msg::SensorBaro> _barometer_pub{ORB_ID(sensor_baro)}; ///< Pressure data publisher
};
@@ -1,7 +0,0 @@
module_name: EULER-NAV BAHRS
serial_config:
- command: eulernav_bahrs start -d ${SERIAL_DEV}
port_config_param:
name: SENS_BAHRS_CFG
group: Sensors
-10
View File
@@ -19,16 +19,6 @@ actuator_output:
parameters:
- group: Actuator Outputs
definitions:
PCA9685_EN_BUS:
description:
short: Enable the PCA9685 output driver
long: |
Enable the PCA9685 output driver.
The integer refers to the I2C bus number where PCA9685 is connected.
type: int32
min: 0
max: 10
default: 0
PCA9685_SCHD_HZ:
description:
short: PWM update rate
+1 -1
View File
@@ -96,7 +96,7 @@ UavcanEscController::update_outputs(uint16_t outputs[MAX_ACTUATORS], unsigned to
_prev_cmd_pub = timestamp;
uavcan::equipment::esc::RawCommand msg = {};
uavcan::equipment::esc::RawCommand msg;
// directly output values from mixer
for (unsigned i = 0; i < total_outputs; i++) {

Some files were not shown because too many files have changed in this diff Show More