I'm working towards a UAV plane drop from a weather balloon near 100k ft, and trying to use the events.pde file to pull the release pin based on altitude.  Since I'm pretty new to arduino, I'm starting simple.  Trying to make the rudder kick over to -45 after 30 seconds, so I put this snippet in the bottom of the events.pde file.  Compiler doesn't like elapseTime or servo_out.  Is that because those variables are not used anymore?  Because I stole the snippet from this post?


// called after every single control loop
void mainLoop_event(void)
        if(elapsedTime > 30000){ // 30sec
                servo_out[CH_RUDDER] = -45;

Views: 228

Reply to This

Replies to This Discussion

I'm getting closer.  I see that I should use a servo command like the one below.  Now I just need some advice on the best place to call it from the main arduplane code.  I currently call "event_rudderkick();" at the top of the navigate() function.  Later I will change it from a rudderkick to something that will pull the egg drop pin based on altitude.  

Any idea why the rudder only goes to -45 for a brief moment?  I tried to use the delay command.

// called when entering navigation
void event_rudderkick(void)
       g.channel_rudder.servo_out = -45;
       APM_RC.OutputCh(CH_4, g.channel_rudder.servo_out); // send to Servos

1. servo_out is in centidegrees between -4500 and 4500

2. You're blocking for 10 seconds, which is going to stop any code from running for 10 seconds. You have to be careful. Manual mode *might* still work if you do this (I think it is interrupt-driven), but I'm not sure.

3. You're going to have to disable the yaw PID in Attitude.pde, or set servo_out after it, in order to use the rudder servo. Why are you using the rudder servo channel? Use servo 5, 6, 7, or 8.

If you just set g.channel_rudder.servo_out to -4500, and disable the yaw PID while it is set, it should hold it for as long as it is set.

I hope this gives you some ideas.

Awesome.  Thanks a lot for the help.

Reply to Discussion



Season Two of the Trust Time Trial (T3) Contest 
A list of all T3 contests is here. The current round, the Vertical Horizontal one, is here

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service