Coding AUX servo functions into 2.7.3

Hi

I need to control 2 Aux servos from a APM1 board. Trying to use the camera channels and change the code to control them directly.

If anyone could help me with:

- where are the output pins initiallised?

- I am trying to use one of these lines to control the servo.

 g.rc_5.servo_out = 900;


 APM_RC.OutputCh(Ch_6, 900);

Added into the medium loop

Am I on the right track?

Thanks for any help.

Graham

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • I think you are on the right track. I've been searching on documentation for doing this but haven't had too much luck. I'm using an Arduplane and older firmware, but the process should be similar.

    I've been able to get servos to move by using the APM_RC.OutputCh command you are using. However the trouble I'm having is I need to put a delay after each move command to get them to move significantly, otherwise they just twitch like crazy. Obviously this isn't acceptable behavior because the rest of the Ardupilot locks up while the servos are moving.

    I'm trying to figure out if there is something overwriting or re-initializing the servos after I send my move commands. That seems to be the only thing I could think of that could cause that problem as I think the way APM_RC.OutputCh is intended to work is to send the command once and have the servos move to the appropriate position (correct me if I'm wrong!)

    I've gone through the RC libraries, radio.pde, etc but haven't had a whole lot of luck

    Here is my code (which I'm running inside the one_second_loop, using a static int test_flag as a boolean type variable)


    if (test_flag==0){
    g.rc_5.servo_out = 2000;
    APM_RC.OutputCh(CH_5,2000);
    test_flag=1;
    delay(500);
    }
    if (test_flag==1){
    g.rc_5.servo_out = 1000;
    APM_RC.OutputCh(CH_5,1000);
    test_flag=0;
    delay(500);
    }

    This code reliably makes a servo move back and forth, but the APM locks up during the delay commands (at least the HUD does) Without the delay the servo only buzzes/twitches. With a shorter delay the servo will move but not completely.

    Need to figure out how to control them without a delay!

    Hope this can help and I hope we can get some good replies

    • Is this still actual?

       

      I want to implement a further servo to the ardu-plane for tilting rotors.

      If i´ll test with your code Ryan, at which output pin I should check? Or its an Aux-output?

       

      Greets

      Sigge

This reply was deleted.

Activity

DIY Robocars via Twitter
RT @chr1sa: Donkeycar 4.4 released with tons of new features, including path learning (useful with GPS outdoors), better Web and Lidar supp…
Nov 27
DIY Robocars via Twitter
RT @NXP: We are already biting our nails in anticipation of the #NXPCupEMEA challenge! 😉 Did you know there are great cash prizes to be won…
Nov 24
DIY Robocars via Twitter
RT @gclue_akira: レースまであと3日。今回のコースは激ムズかも。あと一歩 #jetracer https://t.co/GKcEjImQ3t
Nov 24
DIY Robocars via Twitter
UC Berkeley's DIY robocar program https://roar.berkeley.edu/
Nov 24
DIY Robocars via Twitter
RT @chr1sa: The next @DIYRobocars autonomous car race at @circuitlaunch will be on Sat, Dec 10. Thrills, spills and a Brazilian BBQ. Fun…
Nov 24
DIY Robocars via Twitter
RT @arthiak_tc: Donkey car platform ... Still training uses behavioral cloning #TCXpo #diyrobocar @OttawaAVGroup https://t.co/PHBYwlFlnE
Nov 20
DIY Robocars via Twitter
RT @emurmur77: Points for style. @donkeycar racing in @diyrobocars at @UCSDJacobs thanks @chr1sa for taking the video. https://t.co/Y2hMyj1…
Nov 20
DIY Robocars via Twitter
RT @SmallpixelCar: Going to @diyrobocars race at @UCSDJacobs https://t.co/Rrf9vDJ8TJ
Nov 8
DIY Robocars via Twitter
RT @SmallpixelCar: Race @diyrobocars at @UCSDJacobs thanks @chr1sa for taking the video. https://t.co/kK686Hb9Ej
Nov 8
DIY Robocars via Twitter
RT @PiWarsRobotics: Presenting: the Hacky Racers Robotic Racing Series in collaboration with #PiWars. Find out more and register your inter…
Oct 23
DIY Robocars via Twitter
RT @Hacky_Racers: There will be three classes at this event: A4, A2, and Hacky Racer! A4 and A2 are based around UK paper sizing and existi…
Oct 23
DIY Robocars via Twitter
Oct 23
DIY Robocars via Twitter
Oct 19
DIY Robocars via Twitter
Oct 18
DIY Robocars via Twitter
RT @NeaveEng: Calling all UK based folks interested in @diyrobocars, @f1tenth, @donkey_car, and similar robot racing competitions! @hacky_r…
Oct 13
DIY Robocars via Twitter
RT @araffin2: 🏎️ After hours of video editing, I'm happy to share a best of my Twitch videos on learning to race with RL. 🏎️ Each part is…
Oct 13
More…