Wednesday, November 19, 2014

MAV_TYPE , MAV_AUTOPILOT

MAV_TYPE describe type of micro air vehicles ex. Quadrotor,Hexrotor,Fixed Wing


MAV_AUTOPILOT describe type of autopilot(Flight Controller board) 
ex. PIXHAWK,ArduPilotMega / ArduCopter


Ref:

Sunday, November 16, 2014

Arducopter Flight Mode

In HEARTBEAT( Msg id 0) consist of Flightmode stored in custom_mode field
but in MAVLink document didn't define this field because it depend on
which flight controller software was using in this case Arducopter
it was define in file "defines.h"

// 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

Ref:

Thursday, November 13, 2014

Checking MAVLink Arm/Disarm Status


In HEARTBEAT( Msg id 0) consist of arm/disarm status but it not show directly
arm/disarm these stored in base_mode field describe by MAV_MODE_FLAG

HEARTBEAT Message Structure


MAV_MODE_FLAG

As you can see MAV_MODE_FLAG_SAFETY_ARMED 0b10000000 is arm/disarm bit
so we can write simple code to check arm/disarm status from base_mode like these



base_mode & MOTORS_ARMED) >> 7

output is 1 when armed, 0 when disarm

Ref :
https://pixhawk.ethz.ch/mavlink/

Wednesday, November 12, 2014

MAVLink MAV_DATA_STREAM from Board Ardupilot Mega 2

in MAVLink status from flight controller pack together in MAVLink Message
ex. Msg id #30 ATTITUDE consist of roll,pitch,yaw,roll speed,pitch speed,yaw speed

but in case of requesting these msg from flight controller we need to send request to flight controller for MAV_DATA_STREAM and frequency of these stream

MAV_DATA_STREAM  is collection of different msg id group together

MAV_DATA_STREAM 
(https://pixhawk.ethz.ch/mavlink/)

for Adupilot Mega 

RAW_SENSOR
(#27) RAW_IMU
(#29) SCALED_PRESSURE

EXTENDED_STATUS
(#1) SYS_STATUS
(#24) GPS_RAW_INT
(#42) MISSION_CURRENT
(#62) NAV_CONTROLLER_OUTPUT

RC_CH
(#35) RC_CHANNELS_RAW
(#36) SERVO_OUTPUT_RAW

POSITION
(#33) GLOBAL_POSITION_INT

EXTRA 1
(#30) ATTITUDE

EXTRA 2
(#74)VFR_HUD

EXTRA 3
(#2) SYSTEM_TIME

Ref :
https://pixhawk.ethz.ch/mavlink/

Sunday, November 9, 2014

Sending single precision floating point over serial

Single Precision Float (32-bit) in IEEE754 standard
consist of sign bit(1 bit),exponent(8 bits) and fraction(23 bits)

http://upload.wikimedia.org/wikipedia/commons/thumb/e/e8/IEEE_754_Single_Floating_Point_Format.svg/2000px-IEEE_754_Single_Floating_Point_Format.svg.png

using typedef union for merge float,byte array into same location

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]);

Sunday, October 26, 2014

Install PyMAVLink Tool

PyMAVLink is Tool for Bindings MAVLink with Python and also provide number tools for data analysis MAVLink stream logs

Download
git clone git://github.com/mavlink/mavlink.git

For Ubuntu
sudo apt-get install python-matplotlib

After Install Mathplot install PyMAVLink
cd ~
mkdir -p src
cd src
git clone https://github.com/mavlink/mavlink/
cd mavlink/pymavlink
python setup.py install --user

After install PyMAVLink it will show path in status message.It may vary
example : $HOME/.local/lib/python2.6/site-packages/
Edit ~/.bashrc or ~/.bash_profile and add this line:

export PYTHONPATH="$HOME/.local/lib/python2.6/site-packages/:$PYTHONPATH"
export PATH="$HOME/.local/lib/python2.6/bin/:$PATH"

Reference
1.http://qgroundcontrol.org/mavlink/pymavlink
2.http://pixhawk.org/dev/pymavlink

Saturday, October 11, 2014

Fixing QT GUI font Issue on Linux,Windows


Windows 7 version

Ubuntu 12.04 LTS version

with same code of  PyQt application came out with different outcome
this issue case of different in default font family and font size 

fixing by define correctly font in code
self.setStyleSheet('font-size: 8pt; font-family: Tahoma;')

result after fixed problem

Ubuntu 12.04 LTS version (after fixed problem)