Thursday, May 9, 2013

18. More additions to our UDB4 Dev Board

Below is our Dev Board with 3DR G.P.S. MTK V2.0: 

 

Here in the picture below we have added/soldered 7 female (can be seen on the left side of the board) burst pins so that our receiver can be directly connected to the board of our Auto-Pilot (nearly burned my fingers while soldering the burst pins on the board!!! lols!):


The following changes we are making in the head of the fuselage, in order to place our whole Auto-Pilot with G.P.S.Setup in here:








Monday, May 6, 2013

17. UDB4 DevBoard arrived - New Features n Additions

Our UDB4 Devboard arrived today. It has the following features:
  1. Compatible with 20-channel EM-406A SiRF III GPS
  2. Compatible with 50-channel GS407 Helical GPS
  3. DSPIC33FJ256 Controller (with onboard 3.3V and 5V glue logic)
  4. DSPIC runs at 120MHz with 8MHz resonator and PLL
  5. MMA7361 three axis accelerometer
  6. IDG500 dual axis gyro and ISZ500 single axis gyro
  7. External 256Kbit EEPROM
  8. Up to 8 Input, 8 output PWM points
  9. 6-wire debug header or ICSP header
  10. 4 separate colored status LEDs
  11. On board 3.3V and 5V regulators (150mA max)
  12. Spare USART connection for debugging, flight logging, wireless telemetry, etc.
  13. 30 spare analog and digital I/O pins for debugging and interfacing to sensors
We added a slot (covering UART RX2, TX2 and GND) to transmit our data for telemetry and another for programming the micro-controller through PIC-Kit 2. You can install the version of PIC-Kit 2 (2.61) and replace a file in it if you already have one and do not wish to use PIC_Kit 3. You may find the necessary software and other stuff for this purpose at the google devboard discussion forum - Software and Replacement File.


For providing power supply to the UDB4 DevBoard we will use our previously made supplier (9 Volt Adapter and 7805 voltage regulator along with 100 micro-farad capacitor). 
For UD4 DevBoard we will open MatrixPilot-udb4 program in MPLab IDE software. One of the majore differences here is that the serial output format is defined as: #define SERIAL_OUTPUT_FORMAT SERIAL_MAVLINK and the type of board is defined as: #define BOARD_TYPE UDB4_BOARD.

Saturday, May 4, 2013

16. Auto Take-Off and Auto-Landing programming of the #UAV

For our Auto Take-Off and Auto-Landing - We went in the  waypoints.h file of Matrix-Pilot (in MPLab IDE) and entered the following waypoints:

const struct waypointDef waypoints[] = {
{ {   8000,   0, 500 } , F_TAKEOFF, CAM_VIEW_LAUNCH } ,  // return to, and loiter 75 meters above the start-up position
{ {   5000,   0, 300 } , F_NORMAL, CAM_VIEW_LAUNCH } ,
    { {   2000,   0, 150 } , F_LAND, CAM_VIEW_LAUNCH } ,
{ {   1000,   0, 50 } , F_LAND, CAM_VIEW_LAUNCH } ,
{ {   -3000,   0, 10 } , F_LAND, CAM_VIEW_LAUNCH } ,
} ;

Here F_TAKEOFF initiates the takeoff  (i.e quickly gain the altitude and the waypoint) code for its respective waypoint and F_LAND initiates the Landing Code (in this the throttle turns off at the waypoint prior to its own).

To switch fom Loiter waypoint/mode to next waypoint: 

Since the whole Auto-Pilot mode works on one waypoint only, hence to switch out from it we only need to move to the next waypoint. We opened the telemetry.c file (which controls the transmitting and receiving of serial data) and entered a new character 'N' in the following function. On sending 'N' from Happy Kill-more G.C.S to the micro-controller, our program  (and in turn our U.A.V.) will switch to the next waypoint with the help of next_waypoint function. 

All the above editions are shown below:

void udb_serial_callback_received_byte(uint8_t rxchar) // An interrupt, for serial data, being called in the seriall0_udb.c file
{
(* sio_parse) ( rxchar ) ; // parse the input byte i.e. address of character in function void sio_newMsg() will be loaded in this
return ;
}
void sio_newMsg( uint8_t inchar )
{
if ( inchar == 'V' )
{
sio_parse = &sio_voltage_high ;
}
else if ( inchar == 'N' )
{ next_waypoint();
}
#if ( FLIGHT_PLAN_TYPE == FP_LOGO )
else if ( inchar == 'L' )
#else
else if ( inchar == 'W' )
#endif


After this we entered the following waypoints to join/club both Auto-Pilot and Auto Take-Off & Landing Programs:

const struct waypointDef waypoints[] = {
{ {   0,   0, 500 } , F_LOITER, CAM_VIEW_LAUNCH },
{ {   8000,   0, 500 } , F_NORMAL, CAM_VIEW_LAUNCH } ,  // return to, and loiter 75 meters above the start-up position
{ {   5000,   0, 300 } , F_NORMAL, CAM_VIEW_LAUNCH } ,
    { {   2000,   0, 150 } , F_LAND, CAM_VIEW_LAUNCH } ,
{ {   1000,   0, 50 } , F_LAND, CAM_VIEW_LAUNCH } ,
{ {   -3000,   0, 10 } , F_LAND, CAM_VIEW_LAUNCH } ,
} ;

Here F_LOITER (Post 6. How are we going to build a more stable Loiter program?) initiates the Auto-Pilot code for its respective waypoint.

Friday, May 3, 2013

15. What's the next program in #UAV designing?

We are planning for a auto take-off and auto-landing. While Auto take-off won't be such a problem, auto landing will be since we have to ensure enough amount of battery for landing and control the gyros and the throttle very specifically so that our U.A.V. might not crash.

14. What is MatrixPilot? A Glance.

MatrixPilot is the latest firmware for the UAV Dev Board. It is based on William Premerlani's MatrixNav and AileronAssist firmwares, adds many important and fun new features, and allows much more configurability.

Supported Air Frames:

MatrixPilot can be used to control a wide variety of airframes:
  • Standard Airplane: Stabilize and navigate using elevator, and either ailerons, rudder, or both. This is the Airframe type to use if you're upgrading from AileronAssist or MatrixNav.
  • Delta Wing: Similar to the Standard Airplane, but all control is performed through the 2 "elevon" control surfaces.
  • V-Tail: Similar to the Standard Airplane, but rudder and elevator channels are mixed for a V-Tail configuration.

More Radio Inputs and Servo Outputs:

MatrixPilot currently supports a few different configurations of Radio Inputs, and Servo Outputs. Out of the box, you can plug in 4 Input channels and 3 Servo Outputs. You can extend that either by wiring up cables to the spare pins for a total of 5 Inputs and 6 Outputs, or by using a single PPM input, which allows you up to 8 Inputs and 9 Outputs.

Each Input channel can be configured as one of the following:

  • Throttle
  • Aileron
  • Elevator
  • Rudder
  • Mode Switch: Control the state of the firmware between manual, auto (you can still add your control on top of the stabilization), and return-to-launch (you can still add your control on top of the stabilization and navigation)
  • Camera Pitch, and Camera Yaw controls for manually aiming an on-board camera
  • OSD Switch: Turn the OSD on and off
  • Passthrough: Allows passing up to 4 RC channels directly through to corresponding output channels. This can be helpful when you're using PPM RC input, and you need to control something like flaps which are not controlled natively yet by MatrixPilot.

Each Output channel can be configured as one of the following:

  • Throttle
  • Aileron
  • Elevator
  • Rudder
  • 2nd Aileron (separately reversible from the main aileron output)
  • Camera Roll, Camera Pitch, and Camera Yaw controls for stabilizing and targeting an on-board camera
  • Trigger to control things like turning on LEDs, releasing a tow-line, taking a photo, etc.
  • Passthrough

Each of the 3 hardware switches on the board can also be configured to reverse any of the output channels.
Connecting the Extra Input and Output Channels.

The board includes built-in connections for 4 Radio Input and 3 Servo Output channels.

To use the 5th Input channel, and the 4th, 5th, and 6th Output channels, see the Connecting Extra Channels page. Or to use PPM Input for a total of 8 Inputs and 9 Outputs, see the PPM Input page.

Telemetry:

MatrixPilot has support for outputting telemetry data in one of a few different formats. If you add an XBee radio, or something similar, you can monitor your plane's status from the ground while flying.

  • UDB and UDB_Extra: These formats are compatible with a tool we've developed called Flan (FLight ANalyzer), which helps you visualize flights in Google Earth, and explore flight details in a spreadsheet.
  • ArduStation: This format is compatible with the ArduPilot ground station, and the ArduStation hardware ground station.
  • OSD_Remzibi: This format can be wired directly into the Remzibi On-Screen-Display to show important data on an overlay on top of your live, first-person video feed coming from the plane, if you're rigged up for that.

Camera Stabilization:

MatrixPilot includes the ability to stabilize a camera, and even to have the UDB automatically target the camera at a specific locations in 3D space as you fly around.

13. Back on track at last, found the solution to our UAV simulation problem!

Well here is the summary of the whole root of the Problem and its solution:

What we faced:

Its the own designed DSPIC30F4011 board (UDB3), which is designed for Simulation in Xplane specifically . We are using the latest code version. It simulates all the modes well without telemetry (with Serial_None in options.h). But if we enable any telemetry in options.h, micro-controller works well in manual and stabilized mode and in Auto-Pilot mode it gets reset.

We discussed this at the Gentlenav Group at Google Discussion Forum: You can access it below:


So coming back what the actual problem was?

We were using the older version of MPLab IDE (Version 8.36) which did not use legacy-libc file (meaning you could not use it in this version). This file is generally required to reduce the processing power of cpu accessed by the printf and scanf functions in the programs. Due to this the printf and scanf functions increased the micro-controller's cpu processing upto 65% which led to the micro-controller/G.P.S. resetting whenever we switched to the Auto-Pilot mode (ideal cpu processing is around 8%).

How did we solve it?

With the suggestions from - 
uavdevboard › GPS resetting in AutoPilot Mode - We switched to MPLab IDE Version 8.9 which used the legacy-libc file and thus we were able to reduce the processing of the cpu of our micro-controller to 10%.

(How to enable legacy-libc? Go to MPLab - Project - Build Options - Project - MPLAB Link30 - Use alternate settings - add/type " -legacy-libc' at the end)


We simulated our program again and this time when we switched to the Auto-Pilot simultaneously with the telemetry it worked just fine.

Special thanks to Robert, Pete and Bill at Gentlenav's Google Discussion Group and Morli at the DIY Drones discussion forum!!!

You may also access this conversation below:


12. Reading now-a-days

Now a days reading - A coupled estimation and control analysis for attitude stabilisation of mini aerial vehicles, by - Robert Mahony, Sung-Han Cha & Tarek Hamel.