I've been reading the most recent Arducopter 2.5.4 version, I cannot understand how the commands are sent to the servos/motors.
I understand that the function "set_servos_4()" is doing the job, but after that I'm lost.
An instance of the class AP_MotorsQuad is created (and called "motors") and the method "output" should use the "output_armed()" function whose definition I cannot find...
Sorry I'm a newb!
Ok I found the output_armed() function definition in AP_MotorsMatrix.cpp file.
set_servos_4() calls motors.output();
motors.output() (output() defined in AP_Motors.h) calls output_armed() (defined in AP_MotorsMatrix.cpp).
I hope this helps someone like me who is lost with objects/classes/methods...
I've been thinking about removing that set_servos_4 call and just directly calling motors.output(). It's a bit silly to have a function with just one line of code in it. It use to have a lot more in there before we moved it all to the AP_Motors library.
If you look inside the AP_Motors files you will see lines like below. This is the call to send the message to the servos.
_rc is a pointer to an APM_RC object. The first parameter, _motor_to_channel_map[i], determines which actual output pin on the apm to send the message to (i think we have about 12 output pins/channels).
the 2nd parameter, motor_out[i], is the actual pwm value to send (a value from 1000~2000 i believe).
APM_RC is the library which we use to make the very low-level pwm output to the ESCs and servos. you can check out it's OutputCh method to see the very low level registry update it does to send out the signal.
Thank you for your explanation!
michele, here can i get a c file for this code......i wanna c if i can change it according to my model???? so can u please gimme a link????
Sorry, I don't understand your question!
If you don't find the source code, here is it:
thats was actually " Where can i find the C code for this"....i missed a "W".....so can this APM be changed or modified for a different vehicle????? like VFO`s.....????? And where should i start??? i mean which file of the c code??? i wanna change the outputs........like with pitch these control surfaces should move??? any ideas???
yes i am talking abt the C ++ code!!!!!!! so i have designed this model with takes of vertically....so it has a very different controls....http://www.sussex-model-centre.co.uk/shopexd.asp?id=30453...can u please tell me where should i start to modify the controls????
Yikes. Not sure what vehicle that would fit best under. It has surfaces, so plane, but requires constant power to control altitude, so copter.
I would go with a traditional heli configuration, perhaps and modify from there. The heli has servos and a rotor, so it would fit better.
You will find that if you look for the keyword HELI in the ArduCopter code, it is a set of
which modify the main ArduCopter to do a traditional heli. You could presumably make a
section to make your own type of vehicle.
hahahahaha....same problem here!!!! so i should download arducopter source code????riiiteee???