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 @breadcentric: See how the April AWS DeepRacer races have ended and a couple bits of news: https://blog.deepracing.io/2021/05/09/aws-deepracer-league-2021-update-11-end-of-april-special/ #AWSDeepRacer #Machin…
yesterday
DIY Robocars via Twitter
RT @sunilmallya: Representation Learning +Instance Transfer to learn new reward functions along with advantage based filtering of new exper…
Monday
DIY Robocars via Twitter
Apr 27
DIY Robocars via Twitter
Apr 27
DIY Robocars via Twitter
RT @f1tenth: Sliding (autonomously) into the weekend like ... 🤖😎 #f1tenth #robots #AutonomousVehicles @OpenRoboticsOrg @NVIDIAEmbedded @Aut…
Apr 25
DIY Robocars via Twitter
RT @chr1sa: One of the problems with autonomous car racing is that watching software drive is not a very exciting spectator sport. To help…
Apr 25
DIY Robocars via Twitter
RT @SmallpixelCar: Replaced AGX Xavier with @NVIDIAEmbedded Jetson Xavier NX. Now both cars look fast and clean https://t.co/jlcoY2EjZf
Apr 25
DIY Robocars via Twitter
RT @chr1sa: Yesterday we had a record number of competitors (36) in our monthly @DIYRobocars virtual autonomous car race. We kept it going…
Apr 25
DIY Robocars via Twitter
Apr 16
DIY Drones via Twitter
RT @chr1sa: After more than a year of only virtual races, @DIYRobocars returns to the newly renovated @circuitlaunch on May 22 for the resu…
Apr 11
DIY Robocars via Twitter
RT @DAVGtech: And now available with LiDAR 🔥 https://twitter.com/Heavy02011/status/1381137016381964293
Apr 11
DIY Robocars via Twitter
RT @Heavy02011: #VirtualRaceLeague: @DIYRobocars Race #9 - #ParkingLotNerds #thunderhillracetrack, CA Join us for the next race April 24th,…
Apr 11
DIY Robocars via Twitter
RT @DWalmroth: Weather's finally cooperating, looking forward to racing 1:10 scale autonomous cars outdoors again! @diyrobocars, @NVIDIAEm…
Apr 7
DIY Robocars via Twitter
RT @AIDRI_: I finally succeeded in optimizing the trajectory and speed of a car on a #racetrack. Next step: implement a 2d controller and…
Apr 7
DIY Robocars via Twitter
@jetdillo @circuitlaunch Actually the second *in person* event in a year. We do virtual races every month
Apr 2
DIY Robocars via Twitter
Update: we're moving it back one day to Sunday (the 4th) at 11:00am instead
Apr 2
More…