Howdy,

I'm currently trying to get a servo to rotate when I roll my pixhawk past 10 degrees. I have my working code so far and my pixhawk recognizes when I am rolling the device left or right, but instead of rotating left when rolled left, or rotating right when rolled right it end up rotating the same amount to the right side every time, even when rolled left.

What I would like to know is how could I get my servo to rotate to the left instead of the right?

Here is the code I am using to rotate my servo to the left, after this if statement the signal is published to the actuators:

if (roll < -10)

{

degreechange = m_roll + 10;

rcvalue = degreechange / 180;

acutator.controls[i] = rcvalue;

{

This should give me a negative rcvalue. If I roll my pixhawk -70 degrees then degreechange will be -60 degrees. Then to turn it in to a value from -1f to 1 I divide by 180, this value is now sent to the actuator.controls[i] and it should then get scaled up by the IO_pass mixer file. Since I am sending a negative value then the pixhawk should move the servo to the left correct?

Am I misunderstanding how the acutator.controls[i] works? Am I sending a wrong float number? or is it a problem with my mixer?

Here is the complete code:

Thank you for the help.

http://codeshare.io/RoTcx

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

Join diydrones

Email me when people reply –

Replies

  • Could there be another code function I can use to control the servo, for clockwise and counter clockwise motion?

This reply was deleted.

Activity

gotham liked gotham's profile
4 hours ago
DIY Robocars via Twitter
RT @RoboticMasters: Monaco GP Circuit in the Donkey Sim (coming soon). Including buildings, tunnel and all! https://github.com/robotics-masters/sim-donkeycar-f1/tree/f1-tracks @diyr…
yesterday
DIY Robocars via Twitter
RT @breadcentric: Here are the details of #AWSDeepRacer finals: https://blog.deepracing.io/2020/12/01/aws-deepracer-league-finals-2020-round-1-schedule/ #awsreinvent2020 #AWSreInvent https://t.co/ovqsjp8V…
yesterday
DIY Robocars via Twitter
RT @breadcentric: #AWSDeepRacer League #awsreinvent2020 Open race is on Dec 1st - Dec 31st in three categories, 15 DeepRacer Evo (with LIDA…
yesterday
DIY Robocars via Twitter
RT @a1k0n: @SmallpixelCar @diyrobocars It's just something that's easy to track with chroma keying. I ended up using different colors on th…
Monday
DIY Robocars via Twitter
Monday
DIY Robocars via Twitter
RT @TinkerGen_: "The Tinkergen MARK ($199) is my new favorite starter robocar. It’s got everything — computer vision, deep learning, sensor…
Nov 23
DIY Robocars via Twitter
Nov 23
DIY Robocars via Twitter
RT @roboton_io: Join our FREE Sumo Competition 🤖🏆 👉 https://roboton.io/ranking/vsc2020 #sumo #robot #edtech #competition #games4ed https://t.co/WOx…
Nov 16
DIY Drones via Twitter
First impressions of Tinkergen MARK robocar https://ift.tt/36IeZHc
Nov 16
DIY Robocars via Twitter
Our review of the @TinkerGen_ MARK robocar, which is the best on the market right now https://diyrobocars.com/2020/11/15/first-impressions-of-tinkergen-mark-robocar/ https://t.co/ENIlU5SfZ2
Nov 15
DIY Robocars via Twitter
RT @Ingmar_Stapel: I have now explained the OpenBot project in great detail on my blog with 12 articles step by step. I hope you enjoy read…
Nov 15
DIY Robocars via Twitter
RT @DAVGtech: This is a must attend. Click the link, follow link to read the story, sign up. #chaos2020 #digitalconnection #digitalworld ht…
Nov 15
DIY Robocars via Twitter
RT @a1k0n: Got a new chassis for outdoor races (hobbyking Quantum Vandal) but I totally didn't expect that it might cause problems for my g…
Nov 11
DIY Drones via Twitter
First impressions of the Intel OpenBot https://ift.tt/36qkVV4
Nov 10
DIY Robocars via Twitter
Nov 9
More…