The Design of An Unmanned Aerial Vehicle Based On The Ardupilot
The Design of An Unmanned Aerial Vehicle Based On The Ardupilot
Unmanned flight
http://www.indjst.org
expanded through C++ libraries ,and AVR-C code can be added Wingspan 48.5 in directly into Arduino programs. Deciding on the platform to use Wing area 400 sq in Ground station is very paramount in the building Wing loading 16.1 oz/sq ft The ground station/monitor of a UAV. We Length 36.1 in consists simply of a laptop used the Hobbico Superstar EP Weight 3.11bs computer that is used to display as my platform. The specification Radio 4-channel with three servos the video stream sent by the of the platform chosen is provide Motor Battery 8.4volt 1700mAh-3000mAh UAV. The Aerial video system in Table 1. Center of gravity: 2.5 (63.5mm) -2-7/8 (73mm) back (AVS) used is AVS-KX171 Camera. The AVS is a from the leading edge of the wing at the fuselage side complete wireless video kit with 900MHz frequency, 500mW RF output power, 12V camera. Control Throws : Aerial video system block diagram
Plane
Hardware (Airframe/Platform)
Elevator, Up and Down: Rudder, Right and Left: Ailerons, Up and Down:
makes it easy to write code and upload it to the I/O board. It runs on Windows, Mac OS X, and Linux. The environment is written in Java that serves as a code editor and compiler, and based on Processing and other open source software. The Arduino environment has the following functions: Verify/Compile, Check for errors in the code and uploads the already compiled code to the board. Advantages of the Arduino software 1) Cross-Platform-The Arduino software runs on Windows, Macintosh OSX and Linux operating systems, 2) Simple, clear programming environment, 3) Open source and extensible software, 4) The language can be Research article
Indian Society for Education and Environment (iSee)
Screen shot of simulation in Google Earth is provided in Fig. 6. This method of simulation was developed by Jordi (DIYDRONES). Required hardware: ArduPilot, FTDI cable and computer. Required software: Modified ArduPilot code, X-Plane simulator, Google Earth and Ardu Simulator. The simulation runs in X-plane simulator, while the ArduPilot which is connected via the FTDI cable to the pc receives simulated GPS data over serial and it returns back proposed servo positions back over serial as part of telemetry information. Variables that are recorded include longitude, latitude, altitude, waypoints and distance. Functions of the Ardu simulator 1) Connects to ArduPilot over serial for sending and receiving data, 2) Connects to X-plane on localhost, 3) Reads data from X-plane (lat/lon/alt/ course), sending these to ArduPilot as GPS sentences, 4) Simulating FMA copilot stabilization on ailerons/elevator, 5) Reads and Displays telemetry and servo positions from ArduPIlot, 6) Sends servo positions to X-plane to control throttle and He Bin & Justice
Indian J.Sci.Technol.
Unmanned flight
http://www.indjst.org
14 Indian Journal of Science and Technology rudder and 7) Records fly path and sends it to Google Earth to display. Modified Ardu Pilot Code (samples) //Defining ranges of the servos (and ESC), must be +-90 degrees. #define max16_throttle 2100 //ESC max position, given in useconds, in my ungly servos 2100 is fine, you can try 2000.. #define min16_throttle 1000 //ESC position #define max16_yaw 2100 //Servo max position #define min16_yaw 1000 //Servo min position #define reverse_yaw 1 // normal = 0 and reverse = 1 //PID max and mins #define heading_max 15 #define heading_min -15 #define altitude_max 40 #define altitude_min -45 //Number of waypoints defined #define waypoints 6 #define distance_limit 4000 //The max distance allowed to travel from home. /****************************************************************
* RTL, if it set as true by the user, the autopilot will always
unsigned int altitude_PID_timer;//Timer to calculate the dt of the PID int altitude_previous_error; float altitude_I; //Stores the result of the integrator float altitude_D; //Stores the result of the derivator int altitude_output; //Stores the result of the PID loop //PID K constants, defined at the begining of the code float kp[]={Kp_heading,Kp_altitude}; float ki[]={Ki_heading,Ki_altitude}; float kd[]={Kd_heading,Kd_altitude}; /*******************************/ char buffer[90]; //Serial buffer to catch GPS data
char head_rmc[]="GPRMC"; //GPS NMEA header to look for char head_gga[]="GPGGA"; //GPS NMEA header to look for
****************************************************************/ #define RTL 1 //0 = waypoint mode, 1 = Return home mode //PID gains //At the beginning try to use only proportional. //The original configuration works fine in my simulator. #define Kp_heading 10 #define Ki_heading .01 #define Kd_heading 0.001 #define Kp_altitude 4 #define Ki_altitude 0.001 #define Kd_altitude 2 /*******************************/ //Defining waypoints variables float wp_lat[waypoints+1]; float wp_lon[waypoints+1]; int wp_alt[waypoints+1]; byte current_wp=1; //This variables stores the actual waypoint we are trying to reach.. byte jumplock_wp=0; //When switching waypoints this lock will allow only one transition.. byte wp_home_lock=0; // int wp_bearing=0; //Stores the bearing from the current waypoint unsigned int wp_distance=0; //Stores the distances from the current waypoint /*******************************/ //PID loop variables unsigned int heading_PID_timer; //Timer to calculate the dt of the PID int heading_previous_error; float heading_I; //Stores the result of the integrator float heading_D; //Stores the result of the derivator int heading_output; //Stores the result of the PID loop Research article
Indian Society for Education and Environment (iSee)
byte unlock=1; //some kind of event flag byte checksum=0; //the checksum generated byte checksum_received=0; //Checksum received byte counter=0; //general counter /*GPS Pointers*/ char *token; char *search = ","; char *brkb, *pEnd; //Temporary variables for some tasks, specially used in the GPS parsing part (Look at the NMEA_Parser tab) unsigned long temp=0; unsigned long temp2=0; unsigned long temp3=0; //GPS obtained information byte fix_position=0;//Valid gps position float lat=0; //Current Latitude float lon=0; //Current Longitude byte ground_speed=0; //Ground speed? yes Ground Speed. int course=0; // Course over ground... int alt=0; //Altitude, //ACME variables byte gps_new_data_flag=0; // A simple flag to know when we've got new gps data. unsigned int launch_altitude =0; //launch altitude, altitude in waypoints is relative to starting altitude. int middle_thr=90; //The central position int middle_yaw=90; //The cnetral position of yaw byte middle_measurement_lock=0; //Another lock to void resetting the middle measurement.. /*******************************/ int test=0; Simulation Results The results of the simulation werent exactly ideal because of certain problems such as the cumbersome nature of specifying individual waypoints manually. Another problem that arose was the altitude control by throttle with the use of the FMA copilot stabilization system which didn't work properly. Apart from this the simulation was successful. The plane flew smoothly and according to predetermined waypoints.
Unmanned flight
http://www.indjst.org
15 Indian Journal of Science and Technology Navigation The Ardupilot operates in two modes, first of all it can be programmed with desired waypoints (any number of waypoints), and also can be programmed to RTL (returnto-launch). Methods Programming the Ardupilot board for desired waypoints involving first obtaining the GPS Longitude and Latitude coordinates of the waypoints and then entering the GPS Longitude and Latitude coordinates into the code in the Arduino environment and uploading it to the board. The coordinates can be obtained from Google Maps, under satellite view. The waypoints (wp-lat and wp-lon) declaration obtained would be pasted on the Mission Setup tab of the Arduino. The altitude is relative to the initial launch position and not above sea level. For an example if the airfield is 500 meters above sea level, then 500 would be entered as the waypoint altitude. Hence the plane will fly at 1,000 meters above sea level but it would be just 500 meters above . Code Sample: void setup_waypoints(void) { /*Declaring waypoints*/ wp_lat[1]= 34.982613; wp_lon[1]= -118.443357; wp_alt[1]=50; //meters wp_lat[2]= 34.025136; wp_lon[2]=-118.445254; wp_alt[2]=100; //meters wp_lat[3]=34.018287; wp_lon[3]=-118.456048; wp_alt[3]=100; //meters wp_lat[4]= 34.009332; wp_lon[4]=-118.467672; wp_alt[4]=50; //meters wp_lat[5]= 34.006476; wp_lon[5]=-118.465413; wp_alt[5]=50; //meters wp_lat[6]= 34.009927; wp_lon[6]= -118.458320; wp_alt[6]= 20; //meters RTL (Return-To-Launch) For the UAV to return-to-launch, then the code still has to be modified. The code #define RTL 0,this is the RTL flag and it should be set to 1 or just set to zero if the UAV is to follow the waypoints in the Mission Setup tab. Autonomous Flight For the first test flight of the UAV, we setup the system as described above i.e., connecting all the components to the board, modifying the code and uploading it to the board. Components include the EM406A GPS, FMA Copilot Stabilization unit, Servos, Tower hobbies 72 MHz 8 channel RX and Tower Hobbies 6 XM TX and the AVS. Research article
Indian Society for Education and Environment (iSee)
The UAV was launched manually and when it was about 150 feet it was switched into autopilot by flipping the control switch which corresponds to our channel 5. The UAV successfully started navigating to the predetermined first waypoint that we uploaded into the board. We then uploaded the RTL code (return tolaunch), the throttle behaved as expected and maintained steady altitude. It returned to launch point. Results and conclusion In this paper, we have discussed the design and implementation and simulation of an Ardupilot based UAV autopilot system. The simple UAV has the ability to implement autonomous flight (automatic take and landing). The developed UAV has been tested successfully in both manual and automatic flight operations. Useful data has also been obtained by the use of computer vision, i.e. the AVS and valuable data has also been obtained by the use of telemetry. Future work Presently waypoints can only be entered pre-flight and manually, this limit the autonomous properties of the UAV .It would be very useful to develop a method to reprogram the waypoints on the controller board midflight. Power consumption is another issue worthy of considering, presently the power rating of the UAV will last only for several minutes without recharging, it would be great if the power rating of the UAV could be reasonably increased. Two methods worthy of consideration is 1) the use of solar panels for recharging mid-flight, 2) the use of automatic recharging, i.e. having the UAV taxiing into predetermined destination and recharging on its own then taking off. This would require the addition of extra electronic components which could drastically affect the weight of the aircraft and could also give rise to magnetic interference.
Fig. 6. Screen shot of simulation in Google Earth
Reference Krus P and Andersson J (2003) Optimizing optimization for design optimization. In: Proceedings of ASME Design Automation Conference, Chicago, USA, September 2-6. He Bin & Justice
Indian J.Sci.Technol.
Unmanned flight
http://www.indjst.org