Skip to content

Instantly share code, notes, and snippets.

View tridge's full-sized avatar

Andrew Tridgell tridge

View GitHub Profile
In file included from /home/tridge/project/UAV/APM/libraries/AP_Math/AP_Math.h:25:
/home/tridge/project/UAV/APM/libraries/AP_Math/AP_Math_PX4.h:17:28: error: no member named 'is_floating_point' in namespace 'std'
static_assert(std::is_floating_point<T>::value, "ERROR - isfinite(): template parameter not of type float\n");
~~~~~^
/home/tridge/project/UAV/APM/libraries/AP_Math/AP_Math_PX4.h:17:46: error: 'T' does not refer to a value
static_assert(std::is_floating_point<T>::value, "ERROR - isfinite(): template parameter not of type float\n");
^
/home/tridge/project/UAV/APM/libraries/AP_Math/AP_Math_PX4.h:15:20: note: declared here
template<class T>
^
nsh> uavcan status
uavcan status
Pool allocator status:
Capacity hard/soft: 500/250 blocks
Reserved: 40 blocks
Allocated: 23 blocks
UAVCAN node status:
Internal failures: 0
Transfer errors: 2
RX transfers: 3442
(gdb) bt
#0 chSysHalt (reason=reason@entry=0x80d0400 <__func__.9909> "i2c_lld_start")
at /home/tridge/project/UAV/APM.chibios/modules/ChibiOS/os/rt/src/chsys.c:192
#1 0x080a72d6 in i2c_lld_start (i2cp=i2cp@entry=0x2000d7a8 <I2CD1>)
at /home/tridge/project/UAV/APM.chibios/modules/ChibiOS/os/hal/ports/STM32/LLD/I2Cv1/hal_i2c_lld.c:765
#2 0x080a488e in i2cStart (i2cp=0x2000d7a8 <I2CD1>, config=config@entry=0x2000a0b4 <ChibiOS::I2CDeviceManager::businfo+60>)
at /home/tridge/project/UAV/APM.chibios/modules/ChibiOS/os/hal/src/hal_i2c.c:101
#3 0x08091c3c in ChibiOS::I2CBus::dma_allocate (this=0x2000a078 <ChibiOS::I2CDeviceManager::businfo>)
at ../../libraries/AP_HAL_ChibiOS/I2CDevice.cpp:106
#4 0x0809490a in ChibiOS::Shared_DMA::lock (this=0x20011c68) at ../../libraries/AP_HAL_ChibiOS/shared_dma.cpp:84
AP_Mount *mount = AP_Mount::get_instance();
if (mount && !mount->allow_take_picture()) {
// mount library says no picture at the moment
return;
}
@tridge
tridge / gist:85ad94f574a74e224619ddef9342469b
Last active May 16, 2018 07:47
testing vision timestamps
Testing of mavlink time sync with VISION_POSITION_ESTIMATE message, using PR:
https://github.com/ArduPilot/ardupilot/pull/8403
Fields are:
estimate_us: the time estimate on recipient of the sending time
off_us: the timestamp in the VISION_POSITION_ESTIMATE message
pin_timestamp_us: the timestamp of the message send from a pin interrupt between the two systems
diff: the error using the new system in the above PR (microseconds)
diff2: the error using just the receive time (the old method that we are replacing, in microseconds)
#!/usr/bin/env python
import can
from can.listener import Listener
import uavcan.transport as tp
import time
class UAVCANListener(Listener):
def __init__(self):
// Note: The following peripherals can't be resolved for DMA: ['TIM4_UP', 'USART2_TX', 'USART2_RX', 'USART3_RX']
#define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(2, 4)
#define STM32_ADC_ADC1_DMA_CHAN 0
#define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5) // shared I2C1_RX,I2C4_TX
#define STM32_I2C_I2C1_RX_DMA_CHAN 1
#define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7) // shared I2C1_TX,I2C2_TX
#define STM32_I2C_I2C1_TX_DMA_CHAN 1
#define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3) // shared I2C2_RX,USART3_TX
#define STM32_I2C_I2C2_RX_DMA_CHAN 7
def to_string(s):
'''desperate attempt to convert a string regardless of what garbage paypal gave us. Better solutions welcome'''
try:
s2 = s.encode('utf-8', 'ignore')
x = u"%s" % s2
return s2
except Exception:
pass
# so its a nasty one. Let's grab as many characters as we can
r = ''
@tridge
tridge / gist:50a646534a15d0f848cdc323389c5bc8
Created July 29, 2018 23:28
load plane beta fw to revo-mini on com12
2018-07-30 09:25:59,071 INFO MissionPlanner.Utilities.Firmware - 71 Trying Port COM12 (C:\Users\michael\Source\Repos\MissionPlanner\Utilities\Firmware.cs:635) [Base Thread]
2018-07-30 09:25:59,090 DEBUG Program - FirstChanceException in: px4uploader (C:\Users\michael\Source\Repos\MissionPlanner\Program.cs:267) [Base Thread]
System.IO.FileLoadException: Could not load file or assembly 'System.IO.Ports, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'System.IO.Ports, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
at px4uploader.Uploader..ctor(String port, Int32 baudrate)
at MissionPlanner.Utilities.Firmware.UploadPX4(String filename, boards board) in C:\Users\michael\Source\Repos\MissionPlanner\Utilities\Firmware.cs:line 639
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging,
465: ALTITUDE {time_usec : 63903290, altitude_monotonic : 544.899108887, altitude_amsl : 544.899108887, altitude_local : 0.0728899389505, altitude_relative : 0.0728899389505, altitude_terrain : nan, bottom_clearance : nan}
2203: ATTITUDE {time_boot_ms : 63897, roll : 0.176129847765, pitch : -0.0907887071371, yaw : 2.88246703148, rollspeed : -0.00157175888307, pitchspeed : -0.00114167109132, yawspeed : -0.00108176632784}
2203: ATTITUDE_QUATERNION {time_boot_ms : 63897, q1 : 0.124609746039, q2 : 0.0561756826937, q3 : 0.0812838822603, q4 : 0.987273812294, rollspeed : -0.00157175888307, pitchspeed : -0.00114167109132, yawspeed : -0.00108176632784}
10: BAD_DATA {Bad prefix, data:['d8']}
47: BATTERY_STATUS {id : 0, battery_function : 1, type : 1, temperature : 32767, voltages : [65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535], current_battery : -1, current_consumed : -1, energy_consumed : -1, battery_remaining : -1, time_remaining : 0, charge_state : 0}
231: ESTIMATOR_STATUS {time_usec : 63720