Hey guys I am new to the Arducopter platform I have deep experience in the Rc Aircraft field,in fact I have made my own tricopter platform using the plug and play KK multicopter control board,I recently realized the Immense potential of the APM control interface for UAV's I have no experience in coding using embedded c but am reasonably good at arduino,I have created a simple balancing robot using the same by interfacing a gyro and an accelerometer ,I am familiar with PID control and anything RC,Lipo batts brushless motors..you name it..but now just venturing out in the arducopter ecosystem I am really lost at what the code,that I downloaded,really do ,I would really appreciate someone telling me step by step and dissecting the code on the way to tell me what does the code actually do and how does it do it,and how does it interface all the sensors present on the IMU to a single stable output to act as an autopilot for whatever platform it is placed on.Please someone help me...plz plz plz.............I am desperate..(ashamed of calling myself an electronics engineering  student........) 

Views: 410

Reply to This

Replies to This Discussion

That's a tall ask. Here's a quick overview.

There is a main loop that runs at 100hz. It updates the desired pitch and roll and passes it to a Timer which overflows at 490hz and pumps the PWM out to the ESCs.

In the main loop we call DCM update. This is the integration of the Gyros and Accels and Maggy/GPS heading. This gives us the orientation. the DCM object is called ahrs in the code. The imu object is the raw sensors The adc object is the low level access to the sensors on the APM1 only.

Next level up is the control which happens at 50hz. User input is converted to degrees * 100 and throttle is 0 - 1000.

Next level up is navigation and you see this is called when we have GPS data.

A script parser runs mission scripts.

You'll see a bunch of loops called a state machine which divides our time slices into manageable chunks for other peripheral tasks.

Jason

Woah!! Drinking through a firehose right now!!Too Much Stuff to Digest but that's fine..just tell me,The DCM collects input form Gyro,Accel,Magnetometer,GPS,Barometer,Sonar,etc and integrates the data to determines the position of the craft with respect to all three axes(gyro),and planes(Accel),and altitude(sonar),orientation with respect to the earth's mag field(Magnetometer)its location in the world(GPS) ,and windspeed(barometer) so in short everything needed to tell the state of the craft,then all these params are integrated into a single input for the PID code,which it can process and decide the output,Am I getting this right?? plz correct me if i am wrong,so let us start clean and simple without all this jargon,I know that the arducopter is a perfected version of the now old Multiwiicopter which uses invensense gyros from the nintendo wii motion plus and accels from the Nunchuck,and there is a desktop software to manage this all,,so let us say i use a basic arduino diecimila and want to use just the gyros from the wii motion plus clone to stabilize a multicopter without any other sensor to complicate the system ,no Autopilot,no fancy desktop software,this system will require constant human input via RC to compensate the gyro drift and I use a simple 4 channel rx can you just guide me to make a basic arduino code to make a multicopter code of my own??  then slowly i will build on that plz !!     

thanks that was really useful I'm about to try and reuse the APM to do a completely different project and hopefully i can use the code up to the DCM level to give me roll pitch yaw and omega (angular acceleration in the body fixed frame) , then add my own control system and pwm output. 

Ha!! I just realized how I silly I was asking such naïve questions about a year ago...have come a long way from asking silly questions to actually getting help from an angel called Fabio verasano who helped me understand the nitty gritties of the code and helped me implement the starlino IMU and DCM tutorial on an arduino using the polulu 9dof stick....thanks to Jason I understand now after a year of crunching arduino code what he was trying to convey in the above reply....

Reply to Discussion

RSS

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service