uavcannode updates and px4_fmu-v4_cannode example

- drivers/uavcannode add baro, mag, gps publications
 - delete old px4_cannode-v1 board
 - add stripped down simple rcS for CAN nodes
This commit is contained in:
Daniel Agar
2020-02-16 12:11:54 -05:00
committed by GitHub
parent 342e0da796
commit d7c3e1066a
54 changed files with 1137 additions and 3184 deletions
+2 -1
View File
@@ -37,6 +37,7 @@ px4_add_library(drivers_accelerometer
)
target_link_libraries(drivers_accelerometer
PRIVATE
conversion
drivers__device
mathlib
)
)
+1 -1
View File
@@ -35,4 +35,4 @@ px4_add_library(drivers_gyroscope
PX4Gyroscope.cpp
PX4Gyroscope.hpp
)
target_link_libraries(drivers_gyroscope PRIVATE drivers__device)
target_link_libraries(drivers_gyroscope PRIVATE conversion drivers__device)
+4 -30
View File
@@ -60,15 +60,10 @@
using namespace time_literals;
//#define PARAM_NO_ORB ///< if defined, avoid uorb dependency. This disables publication of parameter_update on param change
//#define PARAM_NO_AUTOSAVE ///< if defined, do not autosave (avoids LP work queue dependency)
#if !defined(PARAM_NO_ORB)
# include "uORB/uORB.h"
# include "uORB/topics/parameter_update.h"
# include <uORB/topics/actuator_armed.h>
# include <uORB/Subscription.hpp>
#endif
#include "uORB/uORB.h"
#include "uORB/topics/parameter_update.h"
#include <uORB/topics/actuator_armed.h>
#include <uORB/Subscription.hpp>
#if defined(FLASH_BASED_PARAMS)
#include "flashparams/flashparams.h"
@@ -90,14 +85,12 @@ static char *param_user_file = nullptr;
#define PARAM_CLOSE close
#endif
#ifndef PARAM_NO_AUTOSAVE
#include <px4_platform_common/workqueue.h>
/* autosaving variables */
static hrt_abstime last_autosave_timestamp = 0;
static struct work_s autosave_work {};
static volatile bool autosave_scheduled = false;
static bool autosave_disabled = false;
#endif /* PARAM_NO_AUTOSAVE */
/**
* Array of static parameter info.
@@ -146,11 +139,9 @@ UT_array *param_values{nullptr};
/** array info for the modified parameters array */
const UT_icd param_icd = {sizeof(param_wbuf_s), nullptr, nullptr, nullptr};
#if !defined(PARAM_NO_ORB)
/** parameter update topic handle */
static orb_advert_t param_topic = nullptr;
static unsigned int param_instance = 0;
#endif
static void param_set_used_internal(param_t param);
@@ -300,7 +291,6 @@ param_find_changed(param_t param)
static void
_param_notify_changes()
{
#if !defined(PARAM_NO_ORB)
parameter_update_s pup = {};
pup.timestamp = hrt_absolute_time();
pup.instance = param_instance++;
@@ -315,8 +305,6 @@ _param_notify_changes()
} else {
orb_publish(ORB_ID(parameter_update), param_topic, &pup);
}
#endif
}
void
@@ -606,7 +594,6 @@ param_get(param_t param, void *val)
return result;
}
#ifndef PARAM_NO_AUTOSAVE
/**
* worker callback method to save the parameters
* @param arg unused
@@ -616,8 +603,6 @@ autosave_worker(void *arg)
{
bool disabled = false;
#if !defined(PARAM_NO_ORB)
if (!param_get_default_file()) {
// In case we save to FLASH, defer param writes until disarmed,
// as writing to FLASH can stall the entire CPU (in rare cases around 300ms on STM32F7)
@@ -629,8 +614,6 @@ autosave_worker(void *arg)
}
}
#endif
param_lock_writer();
last_autosave_timestamp = hrt_absolute_time();
autosave_scheduled = false;
@@ -648,7 +631,6 @@ autosave_worker(void *arg)
PX4_ERR("param auto save failed (%i)", ret);
}
}
#endif /* PARAM_NO_AUTOSAVE */
/**
* Automatically save the parameters after a timeout and limited rate.
@@ -659,8 +641,6 @@ autosave_worker(void *arg)
static void
param_autosave()
{
#ifndef PARAM_NO_AUTOSAVE
if (autosave_scheduled || autosave_disabled) {
return;
}
@@ -680,13 +660,11 @@ param_autosave()
autosave_scheduled = true;
work_queue(LPWORK, &autosave_work, (worker_t)&autosave_worker, nullptr, USEC2TICK(delay));
#endif /* PARAM_NO_AUTOSAVE */
}
void
param_control_autosave(bool enable)
{
#ifndef PARAM_NO_AUTOSAVE
param_lock_writer();
if (!enable && autosave_scheduled) {
@@ -696,7 +674,6 @@ param_control_autosave(bool enable)
autosave_disabled = !enable;
param_unlock_writer();
#endif /* PARAM_NO_AUTOSAVE */
}
static int
@@ -1410,15 +1387,12 @@ void param_print_status()
utarray_len(param_values), param_values->n, param_values->n * sizeof(UT_icd));
}
#ifndef PARAM_NO_AUTOSAVE
PX4_INFO("auto save: %s", autosave_disabled ? "off" : "on");
if (!autosave_disabled && (last_autosave_timestamp > 0)) {
PX4_INFO("last auto save: %.3f seconds ago", hrt_elapsed_time(&last_autosave_timestamp) * 1e-6);
}
#endif /* PARAM_NO_AUTOSAVE */
perf_print_counter(param_export_perf);
perf_print_counter(param_find_perf);
perf_print_counter(param_get_perf);
+2 -25
View File
@@ -59,13 +59,8 @@
#include <perf/perf_counter.h>
#include <systemlib/uthash/utarray.h>
//#define PARAM_NO_ORB ///< if defined, avoid uorb dependency. This disables publication of parameter_update on param change
//#define PARAM_NO_AUTOSAVE ///< if defined, do not autosave (avoids LP work queue dependency)
#if !defined(PARAM_NO_ORB)
# include "uORB/uORB.h"
# include "uORB/topics/parameter_update.h"
#endif
#include "uORB/uORB.h"
#include "uORB/topics/parameter_update.h"
#if defined(FLASH_BASED_PARAMS)
#include "flashparams/flashparams.h"
@@ -90,14 +85,12 @@ static char *param_user_file = nullptr;
#endif
#define PARAM_CLOSE close
#ifndef PARAM_NO_AUTOSAVE
#include <px4_platform_common/workqueue.h>
/* autosaving variables */
static hrt_abstime last_autosave_timestamp = 0;
static struct work_s autosave_work;
static bool autosave_scheduled = false;
static bool autosave_disabled = false;
#endif /* PARAM_NO_AUTOSAVE */
/**
* Array of static parameter info.
@@ -156,11 +149,8 @@ UT_array *param_values{nullptr};
/** array info for the modified parameters array */
const UT_icd param_icd = {sizeof(param_wbuf_s), nullptr, nullptr, nullptr};
#if !defined(PARAM_NO_ORB)
/** parameter update topic handle */
static orb_advert_t param_topic = nullptr;
static unsigned int param_instance = 0;
#endif
static void param_set_used_internal(param_t param);
@@ -330,7 +320,6 @@ param_find_changed(param_t param)
static void
_param_notify_changes()
{
#if !defined(PARAM_NO_ORB)
parameter_update_s pup = {};
pup.timestamp = hrt_absolute_time();
pup.instance = param_instance++;
@@ -345,8 +334,6 @@ _param_notify_changes()
} else {
orb_publish(ORB_ID(parameter_update), param_topic, &pup);
}
#endif
}
void
@@ -663,7 +650,6 @@ param_get(param_t param, void *val)
return result;
}
#ifndef PARAM_NO_AUTOSAVE
/**
* worker callback method to save the parameters
* @param arg unused
@@ -690,7 +676,6 @@ autosave_worker(void *arg)
PX4_ERR("param save failed (%i)", ret);
}
}
#endif /* PARAM_NO_AUTOSAVE */
/**
* Automatically save the parameters after a timeout and limited rate.
@@ -701,8 +686,6 @@ autosave_worker(void *arg)
static void
param_autosave()
{
#ifndef PARAM_NO_AUTOSAVE
if (autosave_scheduled || autosave_disabled) {
return;
}
@@ -722,13 +705,11 @@ param_autosave()
autosave_scheduled = true;
work_queue(LPWORK, &autosave_work, (worker_t)&autosave_worker, nullptr, USEC2TICK(delay));
#endif /* PARAM_NO_AUTOSAVE */
}
void
param_control_autosave(bool enable)
{
#ifndef PARAM_NO_AUTOSAVE
param_lock_writer();
if (!enable && autosave_scheduled) {
@@ -738,7 +719,6 @@ param_control_autosave(bool enable)
autosave_disabled = !enable;
param_unlock_writer();
#endif /* PARAM_NO_AUTOSAVE */
}
static int
@@ -1497,15 +1477,12 @@ void param_print_status()
utarray_len(param_values), param_values->n, param_values->n * sizeof(UT_icd));
}
#ifndef PARAM_NO_AUTOSAVE
PX4_INFO("auto save: %s", autosave_disabled ? "off" : "on");
if (!autosave_disabled && (last_autosave_timestamp > 0)) {
PX4_INFO("last auto save: %.3f seconds ago", hrt_elapsed_time(&last_autosave_timestamp) * 1e-6);
}
#endif /* PARAM_NO_AUTOSAVE */
perf_print_counter(param_export_perf);
perf_print_counter(param_find_perf);
perf_print_counter(param_get_perf);