Port PX4 to BeagleBone Blue Board using library librobotcontrol instead of a submodule

This commit is contained in:
Bob-F
2018-07-23 21:04:47 -07:00
committed by Beat Küng
parent e989c80205
commit 2ece14bad1
30 changed files with 1184 additions and 15 deletions
+3
View File
@@ -685,6 +685,9 @@ bool preflightCheck(orb_advert_t *mavlink_log_pub, vehicle_status_s &status,
#elif defined(__PX4_POSIX_RPI)
PX4_WARN("Preflight checks for mag, acc, gyro always pass on RPI");
checkSensors = false;
#elif defined(__PX4_POSIX_BBBLUE)
PX4_WARN("Preflight checks for mag, acc, gyro always pass on BBBLUE");
checkSensors = false;
#elif defined(__PX4_POSIX_BEBOP)
PX4_WARN("Preflight checks always pass on Bebop.");
checkSensors = false;
+2 -2
View File
@@ -279,7 +279,7 @@ int led_init()
led_control.timestamp = hrt_absolute_time();
led_control_pub = orb_advertise_queue(ORB_ID(led_control), &led_control, LED_UORB_QUEUE_LENGTH);
#ifndef CONFIG_ARCH_BOARD_RPI
#if !defined(CONFIG_ARCH_BOARD_RPI) && !defined(CONFIG_ARCH_BOARD_BBBLUE)
/* first open normal LEDs */
DevMgr::getHandle(LED0_DEVICE_PATH, h_leds);
@@ -313,7 +313,7 @@ int led_init()
void led_deinit()
{
orb_unadvertise(led_control_pub);
#ifndef CONFIG_ARCH_BOARD_RPI
#if !defined(CONFIG_ARCH_BOARD_RPI) && !defined(CONFIG_ARCH_BOARD_BBBLUE)
DevMgr::releaseHandle(h_leds);
#endif
}
+1 -1
View File
@@ -67,7 +67,7 @@ int do_esc_calibration(orb_advert_t *mavlink_log_pub, struct actuator_armed_s* a
{
int return_code = PX4_OK;
#if defined(__PX4_POSIX_OCPOC)
#if defined(__PX4_POSIX_OCPOC) || defined(__PX4_POSIX_BBBLUE)
hrt_abstime timeout_start = 0;
hrt_abstime timeout_wait = 60_s;
armed->in_esc_calibration_mode = true;
+15 -1
View File
@@ -1150,6 +1150,10 @@ Mavlink::find_broadcast_address()
const struct in_addr netmask_addr = query_netmask_addr(_socket_fd, *cur_ifreq);
const struct in_addr broadcast_addr = compute_broadcast_addr(sin_addr, netmask_addr);
#ifdef __PX4_POSIX_BBBLUE
if (strstr(cur_ifreq->ifr_name, _mavlink_wifi_name) == NULL) { continue; }
#endif
PX4_INFO("using network interface %s, IP: %s", cur_ifreq->ifr_name, inet_ntoa(sin_addr));
PX4_INFO("with netmask: %s", inet_ntoa(netmask_addr));
PX4_INFO("and broadcast IP: %s", inet_ntoa(broadcast_addr));
@@ -1945,6 +1949,10 @@ Mavlink::task_main(int argc, char *argv[])
_mode = MAVLINK_MODE_NORMAL;
bool _force_flow_control = false;
#ifdef __PX4_POSIX_BBBLUE
_mavlink_wifi_name = __PX4_BBBLUE_DEFAULT_MAVLINK_WIFI;
#endif
#ifdef __PX4_NUTTX
/* the NuttX optarg handler does not
* ignore argv[0] like the POSIX handler
@@ -1966,7 +1974,7 @@ Mavlink::task_main(int argc, char *argv[])
int temp_int_arg;
#endif
while ((ch = px4_getopt(argc, argv, "b:r:d:u:o:m:t:fwxz", &myoptind, &myoptarg)) != EOF) {
while ((ch = px4_getopt(argc, argv, "b:r:d:n:u:o:m:t:fwxz", &myoptind, &myoptarg)) != EOF) {
switch (ch) {
case 'b':
_baudrate = strtoul(myoptarg, nullptr, 10);
@@ -1993,6 +2001,12 @@ Mavlink::task_main(int argc, char *argv[])
set_protocol(SERIAL);
break;
case 'n':
#ifdef __PX4_POSIX_BBBLUE
_mavlink_wifi_name = myoptarg;
#endif
break;
#ifdef __PX4_POSIX
case 'u':
+11
View File
@@ -63,6 +63,12 @@
#include <net/if.h>
#endif
#ifdef __PX4_POSIX_BBBLUE
#ifndef __PX4_BBBLUE_DEFAULT_MAVLINK_WIFI
#define __PX4_BBBLUE_DEFAULT_MAVLINK_WIFI "SoftAp"
#endif
#endif
#include <uORB/uORB.h>
#include <uORB/topics/mission.h>
#include <uORB/topics/mission_result.h>
@@ -601,6 +607,11 @@ private:
uint8_t _network_buf[MAVLINK_MAX_PACKET_LEN];
unsigned _network_buf_len;
#endif
#ifdef __PX4_POSIX_BBBLUE
const char * _mavlink_wifi_name;
#endif
int _socket_fd;
Protocol _protocol;
unsigned short _network_port;
+3 -1
View File
@@ -145,6 +145,7 @@ void initialize_parameter_handles(ParameterHandles &parameter_handles)
parameter_handles.battery_v_div = param_find("BAT_V_DIV");
parameter_handles.battery_a_per_v = param_find("BAT_A_PER_V");
parameter_handles.battery_source = param_find("BAT_SOURCE");
parameter_handles.battery_adc_channel = param_find("BAT_ADC_CHANNEL");
/* rotations */
parameter_handles.board_rotation = param_find("SENS_BOARD_ROT");
@@ -423,7 +424,8 @@ int update_parameters(const ParameterHandles &parameter_handles, Parameters &par
param_set_no_notification(parameter_handles.battery_a_per_v, &parameters.battery_a_per_v);
}
param_get(parameter_handles.battery_source, &(parameters.battery_source));
param_get(parameter_handles.battery_source, &(parameters.battery_source));
param_get(parameter_handles.battery_adc_channel, &(parameters.battery_adc_channel));
param_get(parameter_handles.board_rotation, &(parameters.board_rotation));
+2
View File
@@ -143,6 +143,7 @@ struct Parameters {
float battery_v_div;
float battery_a_per_v;
int32_t battery_source;
int32_t battery_adc_channel;
float baro_qnh;
@@ -223,6 +224,7 @@ struct ParameterHandles {
param_t battery_v_div;
param_t battery_a_per_v;
param_t battery_source;
param_t battery_adc_channel;
param_t board_rotation;
+11 -1
View File
@@ -98,10 +98,20 @@ PARAM_DEFINE_FLOAT(BAT_A_PER_V, -1.0);
* means that measurements are expected to come from a power module. If the value is set to
* 'External' then the system expects to receive mavlink battery status messages.
*
* @min 0
* @min -1
* @max 1
* @value 0 Power Module
* @value 1 External
* @group Battery Calibration
*/
PARAM_DEFINE_INT32(BAT_SOURCE, 0);
/**
* Battery ADC Channel
*
* This parameter specifies the ADC channel used to monitor voltage of main power battery.
* A value of -1 means to use the board default.
*
* @group Battery Calibration
*/
PARAM_DEFINE_INT32(BAT_ADC_CHANNEL, -1);
+4
View File
@@ -443,6 +443,10 @@ Sensors::adc_poll()
int bat_voltage_v_chan[BOARD_NUMBER_BRICKS] = BOARD_BATT_V_LIST;
int bat_voltage_i_chan[BOARD_NUMBER_BRICKS] = BOARD_BATT_I_LIST;
if (_parameters.battery_adc_channel >= 0) { // overwrite default
bat_voltage_v_chan[0] = _parameters.battery_adc_channel;
}
/* The valid signals (HW dependent) are associated with each brick */
bool valid_chan[BOARD_NUMBER_BRICKS] = BOARD_BRICK_VALID_LIST;
+3 -2
View File
@@ -626,6 +626,7 @@ void VotedSensorsUpdate::accel_poll(struct sensor_combined_s &raw)
// write the best sensor data to the output variables
if (best_index >= 0) {
raw.timestamp = _last_sensor_data[best_index].timestamp;
raw.accelerometer_integral_dt = _last_sensor_data[best_index].accelerometer_integral_dt;
memcpy(&raw.accelerometer_m_s2, &_last_sensor_data[best_index].accelerometer_m_s2, sizeof(raw.accelerometer_m_s2));
@@ -1022,7 +1023,7 @@ void VotedSensorsUpdate::print_status()
bool
VotedSensorsUpdate::apply_gyro_calibration(DevHandle &h, const struct gyro_calibration_s *gcal, const int device_id)
{
#if !defined(__PX4_QURT) && !defined(__PX4_POSIX_RPI) && !defined(__PX4_POSIX_BEBOP)
#if !defined(__PX4_QURT) && !defined(__PX4_POSIX_RPI) && !defined(__PX4_POSIX_BEBOP) && !defined(__PX4_POSIX_BBBLUE)
/* On most systems, we can just use the IOCTL call to set the calibration params. */
return !h.ioctl(GYROIOCSSCALE, (long unsigned int)gcal);
@@ -1036,7 +1037,7 @@ VotedSensorsUpdate::apply_gyro_calibration(DevHandle &h, const struct gyro_calib
bool
VotedSensorsUpdate::apply_accel_calibration(DevHandle &h, const struct accel_calibration_s *acal, const int device_id)
{
#if !defined(__PX4_QURT) && !defined(__PX4_POSIX_RPI) && !defined(__PX4_POSIX_BEBOP)
#if !defined(__PX4_QURT) && !defined(__PX4_POSIX_RPI) && !defined(__PX4_POSIX_BEBOP) && !defined(__PX4_POSIX_BBBLUE)
/* On most systems, we can just use the IOCTL call to set the calibration params. */
return !h.ioctl(ACCELIOCSSCALE, (long unsigned int)acal);