diff --git a/.gitmodules b/.gitmodules index 97da9da64c..d84bccbd9f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,8 +4,8 @@ branch = master [submodule "src/drivers/uavcan/libuavcan"] path = src/drivers/uavcan/libuavcan - url = https://github.com/PX4/libuavcan.git - branch = px4 + url = https://github.com/dronecan/libuavcan.git + branch = main [submodule "Tools/jMAVSim"] path = Tools/jMAVSim url = https://github.com/PX4/jMAVSim.git diff --git a/src/drivers/uavcan/CMakeLists.txt b/src/drivers/uavcan/CMakeLists.txt index f60f5942d9..087de0cf7e 100644 --- a/src/drivers/uavcan/CMakeLists.txt +++ b/src/drivers/uavcan/CMakeLists.txt @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (c) 2015 PX4 Development Team. All rights reserved. +# Copyright (c) 2015-2021 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 @@ -99,10 +99,10 @@ target_include_directories(uavcan_${UAVCAN_DRIVER}_driver PUBLIC # generated DSDL set(DSDLC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dsdl") set(DSDLC_INPUTS - "${DSDLC_DIR}/com" - "${DSDLC_DIR}/ardupilot" + "${LIBUAVCAN_DIR}/dsdl/ardupilot" + "${LIBUAVCAN_DIR}/dsdl/com" + "${LIBUAVCAN_DIR}/dsdl/cuav" "${LIBUAVCAN_DIR}/dsdl/uavcan" - "${DSDLC_DIR}/cuav" ) set(DSDLC_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/include/dsdlc_generated") @@ -112,7 +112,10 @@ foreach(DSDLC_INPUT ${DSDLC_INPUTS}) list(APPEND DSDLC_INPUT_FILES ${DSDLC_NEW_INPUT_FILES}) endforeach(DSDLC_INPUT) add_custom_command(OUTPUT px4_uavcan_dsdlc_run.stamp - COMMAND ${PYTHON_EXECUTABLE} ${LIBUAVCAN_DIR}/libuavcan/dsdl_compiler/libuavcan_dsdlc ${DSDLC_INPUTS} -O${DSDLC_OUTPUT} + COMMAND + ${PYTHON_EXECUTABLE} ${LIBUAVCAN_DIR}/libuavcan/dsdl_compiler/libuavcan_dsdlc + --outdir ${DSDLC_OUTPUT} ${DSDLC_INPUTS} + #--verbose COMMAND ${CMAKE_COMMAND} -E touch px4_uavcan_dsdlc_run.stamp DEPENDS ${DSDLC_INPUT_FILES} COMMENT "PX4 UAVCAN dsdl compiler" diff --git a/src/drivers/uavcan/dsdl/ardupilot/indication/21000.SafetyState.uavcan b/src/drivers/uavcan/dsdl/ardupilot/indication/21000.SafetyState.uavcan deleted file mode 100755 index e647900916..0000000000 --- a/src/drivers/uavcan/dsdl/ardupilot/indication/21000.SafetyState.uavcan +++ /dev/null @@ -1,7 +0,0 @@ -# -# support for Safety LED on UAVCAN - -uint8 STATUS_SAFETY_ON = 0 -uint8 STATUS_SAFETY_OFF = 255 - -uint8 status diff --git a/src/drivers/uavcan/dsdl/ardupilot/indication/21001.Button.uavcan b/src/drivers/uavcan/dsdl/ardupilot/indication/21001.Button.uavcan deleted file mode 100644 index 879da4803f..0000000000 --- a/src/drivers/uavcan/dsdl/ardupilot/indication/21001.Button.uavcan +++ /dev/null @@ -1,11 +0,0 @@ -# -# support for buttons on UAVCAN -# while a button is being pressed this message should be sent at 10Hz - -uint8 BUTTON_SAFETY = 1 - -uint8 button - -# number of 0.1s units the button has been pressed for. If over 255 -# then send 255 -uint8 press_time diff --git a/src/drivers/uavcan/dsdl/com/hex/equipment/flow/20200.Measurement.uavcan b/src/drivers/uavcan/dsdl/com/hex/equipment/flow/20200.Measurement.uavcan deleted file mode 100644 index 093a9a1c2b..0000000000 --- a/src/drivers/uavcan/dsdl/com/hex/equipment/flow/20200.Measurement.uavcan +++ /dev/null @@ -1,4 +0,0 @@ -float32 integration_interval -float32[2] rate_gyro_integral -float32[2] flow_integral -uint8 quality diff --git a/src/drivers/uavcan/dsdl/cuav/equipment/power/20300.CBAT.uavcan b/src/drivers/uavcan/dsdl/cuav/equipment/power/20300.CBAT.uavcan deleted file mode 100755 index 2c9ff56d53..0000000000 --- a/src/drivers/uavcan/dsdl/cuav/equipment/power/20300.CBAT.uavcan +++ /dev/null @@ -1,41 +0,0 @@ -# -# support for CUAV Smart Battery on UAVCAN -# - -float32 temperature # The surface temperature of the battery -float32 voltage # The total voltage of the battery -float32[<=15] voltage_cell # Battery individual cell voltages -uint8 cell_count # Number of cells -float32 current # The current flowing through the sense resistor -float32 average_current # The average current flowing through the sense resistor -float32 average_power # The average power of the current discharge -float32 available_energy # The predicted charge or energy remaining in the battery -float32 remaining_capacity # The compensated battery capacity remaining -float32 full_charge_capacity # The compensated capacity of the battery when fully charged -float32 design_capacity # The design capacity of the battery -uint16 average_time_to_empty # The predicted remaining battery life at the present rate of discharge, in minutes -uint16 average_time_to_full # The predicted remaining time until the battery reaches full charge, in minutes -uint7 state_of_health # Health of the battery -uint7 state_of_charge # Percent of the full charge [0, 100] -uint7 max_error # max error, expected margin of error in % in the state-of-charge calculation with a range of 1 to 100% -uint16 serial_number # serial number of the battery pack -uint16 manufacture_date # manufacture date, part of serial number of the battery pack -uint16 cycle_count # number of discharge cycles the battery has experienced -uint16 over_discharge_count # Number of battery overdischarge -float32 passed_charge # The amount of charge passing through the sense resistor -float32 nominal_voltage # Nominal voltage of the battery pack -bool is_powering_off # Power off event imminent indication, false if unknown -uint16 interface_error # interface error counter - -uint11 STATUS_FLAG_IN_USE = 1 # The battery is currently used as a power supply -uint11 STATUS_FLAG_CHARGING = 2 # Charger is active -uint11 STATUS_FLAG_CHARGED = 4 # Charging complete, but the charger is still active -uint11 STATUS_FLAG_TEMP_HOT = 8 # Battery temperature is above normal -uint11 STATUS_FLAG_TEMP_COLD = 16 # Battery temperature is below normal -uint11 STATUS_FLAG_OVERLOAD = 32 # Safe operating area violation -uint11 STATUS_FLAG_BAD_BATTERY = 64 # This battery should not be used anymore (e.g. low SOH) -uint11 STATUS_FLAG_NEED_SERVICE = 128 # This battery requires maintenance (e.g. balancing, full recharge) -uint11 STATUS_FLAG_BMS_ERROR = 256 # Battery management system/controller error, smart battery interface error -uint11 STATUS_FLAG_RESERVED_A = 512 # Keep zero -uint11 STATUS_FLAG_RESERVED_B = 1024 # Keep zero -uint11 status_flags diff --git a/src/drivers/uavcan/libuavcan b/src/drivers/uavcan/libuavcan index 29e1aa6c12..76b2c4c338 160000 --- a/src/drivers/uavcan/libuavcan +++ b/src/drivers/uavcan/libuavcan @@ -1 +1 @@ -Subproject commit 29e1aa6c12e3590252b102153d8c62155047a676 +Subproject commit 76b2c4c33858fcde18c50d29184273a495bdbbd1 diff --git a/src/drivers/uavcannode/CMakeLists.txt b/src/drivers/uavcannode/CMakeLists.txt index 7478f21d4a..689302006f 100644 --- a/src/drivers/uavcannode/CMakeLists.txt +++ b/src/drivers/uavcannode/CMakeLists.txt @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (c) 2015-2020 PX4 Development Team. All rights reserved. +# Copyright (c) 2015-2021 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 @@ -52,6 +52,9 @@ if(CONFIG_ARCH_CHIP) elseif(${CONFIG_ARCH_CHIP} MATCHES "stm32") set(UAVCAN_DRIVER "stm32") set(UAVCAN_TIMER 5) # The default timer is TIM5 + if (DEFINED config_uavcan_timer_override) + set (UAVCAN_TIMER ${config_uavcan_timer_override}) + endif() endif() endif() @@ -96,8 +99,9 @@ target_include_directories(uavcan_${UAVCAN_DRIVER}_driver PUBLIC # generated DSDL set(DSDLC_DIR "${PX4_SOURCE_DIR}/src/drivers/uavcan/dsdl") set(DSDLC_INPUTS - "${DSDLC_DIR}/com" - "${DSDLC_DIR}/ardupilot" + "${LIBUAVCAN_DIR}/dsdl/ardupilot" + "${LIBUAVCAN_DIR}/dsdl/com" + "${LIBUAVCAN_DIR}/dsdl/cuav" "${LIBUAVCAN_DIR}/dsdl/uavcan" ) set(DSDLC_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/include/dsdlc_generated") @@ -108,7 +112,10 @@ foreach(DSDLC_INPUT ${DSDLC_INPUTS}) list(APPEND DSDLC_INPUT_FILES ${DSDLC_NEW_INPUT_FILES}) endforeach(DSDLC_INPUT) add_custom_command(OUTPUT px4_uavcan_dsdlc_run.stamp - COMMAND ${PYTHON_EXECUTABLE} ${LIBUAVCAN_DIR}/libuavcan/dsdl_compiler/libuavcan_dsdlc ${DSDLC_INPUTS} -O${DSDLC_OUTPUT} + COMMAND + ${PYTHON_EXECUTABLE} ${LIBUAVCAN_DIR}/libuavcan/dsdl_compiler/libuavcan_dsdlc + --outdir ${DSDLC_OUTPUT} ${DSDLC_INPUTS} + #--verbose COMMAND ${CMAKE_COMMAND} -E touch px4_uavcan_dsdlc_run.stamp DEPENDS ${DSDLC_INPUT_FILES} COMMENT "PX4 UAVCAN dsdl compiler"