Paraglider, with its own pwm regulator

Hi,

I am currently making a paraglider(Several cons and pros for that approach, but I wanted todo something different:) I want to use pixhawk to control it. So the paraglider is like a plane with rudder,elevator and motor. My problem is that the rudder is operated by a brushless motor with a gearbox and a potentiometer as feedback. So I could attach an arduino nano read in the pwm signal from pixhawk and potentiometer and generate a modified pwm out. However I would rather modify the arduplane code, the question is which file to modify:)

So if the potentiometer reads out a value of 512 the esc should get a pulse of 1500 if the stick is in neutral, if the stick is slightly to the left then the potentiometer should read less then 512 and so on.

My pseudo code is shown below:

void setup() {
// put your setup code here, to run once:
deadVal = 50; //if we are close to desired value we will
//save energy by not running motor, i.e a dead pulsewidt
kp = 0.5; //gain to adjust motor input
}

void loop() {
// put your main code here, to run repeatedly:
actualVal = map(analogRead(A0),1000,2000);
desiredVal = pwmRead();//Where can this value be read??

if (abs(desiredVal-actualVal)<deadVal) {
pulseOut(1500);
}
else if (desiredVal<actualVal) {
pulseOut(1500-kp*(actualVal-desiredVal))
}
else{
pulseOut(1500+kp*(desiredVal-actualVal))
}
}

Any help will be highly appreciated.

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

Join diydrones

Email me when people reply –

Replies

  • any updates of your project? I am the same thought as well, apm does not support paragliders yet but we can use arduino to modify the signals from pixhawk, i think we can use arduplane firmware
This reply was deleted.

Activity

Liam left a comment on Agricultural UAVs
"Hi
I'm Liam from T-MOTOR. I would like to reach out to see if there is any possibility for us to work together.
We are a propulsion system manufacturer who offers motors, propellers and ESCs for all kinds of drone applications which vary from secur…"
yesterday
Richard Cox left a comment on Australia
"Anyone in the DIYDRONES Australian subgroup based in Alice Springs, NT?
I am experimenting with Ardupilot (standard Arduplane), Pixhawk 4 FC in a 4-ch
RC "AXN Floater Jet" foamy plane..."
Tuesday
Omar Sykes left a comment on Australia
"Hi everyone, I am looking for someone who is good at drone building, repair and software in Adelaide. Please give me a call on 0477 319 219."
Tuesday
Jørn Ramnæs liked VIDEO LINK's profile
May 28
Mark Harrison left a comment on Moderators
"Wow, Ning2 looks really great on mobile. I had sort of drifted away as my browse-time went more on my phone, so this is great."
May 28
Hank Deucker left a comment on PIXHAWK
"I am sure most will say not again, Pixhawk telemetry. I do need help and all can be reassured that I have spent many hours scouring the net for useful information. I am not new at quadcopter flying, I started in 2012 and have progressed through many…"
May 28
More…