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
How to use the new @donkey_car graphical UI to edit driving data for better training https://www.youtube.com/watch?v=J5-zHNeNebQ
Monday
DIY Robocars via Twitter
RT @SmallpixelCar: Wrote a program to find the light positions at @circuitlaunch. Here is the hypothesis of the light locations updating ba…
Saturday
DIY Robocars via Twitter
RT @SmallpixelCar: Broke my @HokuyoUsa Lidar today. Luckily the non-cone localization, based on @a1k0n LightSLAM idea, works. It will help…
Thursday
DIY Robocars via Twitter
@gclue_akira CC @NVIDIAEmbedded
Nov 23
DIY Robocars via Twitter
RT @luxonis: OAK-D PoE Autonomous Vehicle (Courtesy of zonyl in our Discord: https://discord.gg/EPsZHkg9Nx) https://t.co/PNDewvJdrb
Nov 23
DIY Robocars via Twitter
RT @f1tenth: It is getting dark and rainy on the F1TENTH racetrack in the @LGSVLSimulator. Testing out the new flood lights for the racetra…
Nov 23
DIY Robocars via Twitter
RT @JoeSpeeds: Live Now! Alex of @IndyAChallenge winning @TU_Muenchen team talking about their racing strategy and open source @OpenRobotic…
Nov 20
DIY Robocars via Twitter
RT @DAVGtech: Live NOW! Alexander Wischnewski of Indy Autonomous Challenge winning TUM team talking racing @diyrobocars @Heavy02011 @Ottawa…
Nov 20
DIY Robocars via Twitter
Incredible training performance with Donkeycar https://www.youtube.com/watch?v=9yy7ASttw04
Nov 9
DIY Robocars via Twitter
RT @JoeSpeeds: Sat Nov 6 Virtual DonkeyCar (and other cars, too) Race. So bring any car? @diyrobocars @IndyAChallenge https://t.co/nZQTff5…
Oct 31
DIY Robocars via Twitter
RT @JoeSpeeds: @chr1sa awesomely scary to see in person as our $1M robot almost clipped the walls as it spun at 140mph. But it was also awe…
Oct 29
DIY Robocars via Twitter
RT @chr1sa: Hey, @a1k0n's amazing "localize by the ceiling lights" @diyrobocars made @hackaday! It's consistently been the fastest in our…
Oct 25
DIY Robocars via Twitter
RT @IMS: It’s only fitting that @BostonDynamics Spot is waving the green flag for today’s @IndyAChallenge! Watch LIVE 👉 https://t.co/NtKnO…
Oct 23
DIY Robocars via Twitter
RT @IndyAChallenge: Congratulations to @TU_Muenchen the winners of the historic @IndyAChallenge and $1M. The first autonomous racecar comp…
Oct 23
DIY Robocars via Twitter
RT @JoeSpeeds: 🏎@TU_Muenchen #ROS 2 @EclipseCyclone #DDS #Zenoh 137mph. Saturday 10am EDT @IndyAChallenge @Twitch http://indyautonomouschallenge.com/stream
Oct 23
DIY Robocars via Twitter
RT @DAVGtech: Another incident: https://t.co/G1pTxQug6B
Oct 23
More…