MAV_AUTOPILOT describe type of autopilot(Flight Controller board)
ex. PIXHAWK,ArduPilotMega / ArduCopter
Ref:
// Auto Pilot modes // ---------------- #define STABILIZE 0 // hold level position #define ACRO 1 // rate control #define ALT_HOLD 2 // Altitude Hold #define AUTO 3 // Waypoint #define GUIDED 4 // Hold a single location from command #define LOITER 5 // Hold a single location #define RTL 6 // return to launch #define CIRCLE 7 // orbit around a single location #define LAND 9 // Landing #define OF_LOITER 10 // Hold a single location using optical flow sensor #define DRIFT 11 // DRIFT mode (Note: 12 is no longer used) #define SPORT 13 // earth frame rate control #define FLIP 14 // flip the vehicle on the roll axis #define AUTOTUNE 15 // autotune the vehicle's roll and pitch gains #define POSHOLD 16 // position hold with manual override #define NUM_MODES 17
base_mode & MOTORS_ARMED) >> 7
typedef union { float floatingPoint; byte binary[4]; } binaryFloat; binaryFloat temp; temp.floatingPoint = 3.1416; Serial.write(temp.binary[3]); Serial.write(temp.binary[2]); Serial.write(temp.binary[1]); Serial.write(temp.binary[0]);
git clone git://github.com/mavlink/mavlink.git
sudo apt-get install python-matplotlib
cd ~ mkdir -p src cd src git clone https://github.com/mavlink/mavlink/ cd mavlink/pymavlink python setup.py install --user
export PYTHONPATH="$HOME/.local/lib/python2.6/site-packages/:$PYTHONPATH" export PATH="$HOME/.local/lib/python2.6/bin/:$PATH"
self.setStyleSheet('font-size: 8pt; font-family: Tahoma;')
git clone https://github.com/mavlink/pymavlink
#!/usr/bin/env python ''' PyMAVLink Test ''' import sys, os, time from math import radians import mavlinkv10 as mavlink import mavutil # create a mavlink instance mav1 = mavutil.mavlink_connection("COM12", 57600) print("Waiting for HEARTBEAT") mav1.wait_heartbeat() print("Heartbeat from APM (system %u component %u)" % (mav1.target_system, mav1.target_component )) while True: mav1.recv_msg() #Do Somethings time.sleep(0.01)
if os.getenv('MAVLINK10'): import mavlinkv10 as mavlink else: import mavlink
#!/usr/bin/env python import sys, os, time from math import radians os.environ["MAVLINK10"] = "1" #Set Mavlink Version 1.0 import mavlinkv10 as mavlink import mavutil # create a mavlink instance mav1 = mavutil.mavlink_connection("COM12", 57600) print("Waiting for HEARTBEAT") mav1.wait_heartbeat() print("Heartbeat from APM (system %u component %u)" % (mav1.target_system, mav1.target_component )) while True: mav1.recv_msg() #Do Somethings time.sleep(0.01)
git clone https://github.com/drgowen/ardupilot-sdk-python
def getIMU(self): if 'RAW_IMU' not in self.mav.messages: raise Error("Haven't received RAW_IMU information yet") att = self.mav.messages['RAW_IMU'] return self.dictCopy(att, ['xacc','yacc','zacc'])
from ardupilot import ArduPilot import time as time_ #make sure we don't override time def millis(): return int(round(time_.time() * 1000)) ac = ArduPilot("/dev/ttyUSB0",57600) #ac.arm() #ac.disarm() start_time = millis() while(1): if(millis()-start_time > 200): print ac.getAttitude() print ac.getIMU() start_time = millis()