| Arduino Forum ::  Members :: jabbado
 Show Posts Pages: 1 [2] 3 4
 16 Using Arduino / Project Guidance / Re: Tricopter algorithm [HELP - CONFIRM] on: December 25, 2012, 06:59:19 am Ok, take the pitch calculation. Now that you have +/- error values depending on whether the tri is pitching up or down, when that value is fed to the PID it's output will also change.So inCode:THROTTLE_PID_BACK               = Receiver_throttle_val + PID_pitch_outputPID_pitch_output will sometimes be negative and sometimes positive depending on the pitch error. So there's no need for "if the output is positive" etc.If you forget about whether it's a tri, quad, hex or whatever and just treat it as a generalized multicopter with pitch, roll, yaw (and vertical speed), you can do all the PID stuff in those three axes then map it to the motor commands at the end. Here's the motor command calc for a tricopter from the Aeroquad code:Code:void applyMotorCommand() {  motorCommand[FRONT_LEFT]    = throttle + motorAxisCommandRoll - motorAxisCommandPitch*2/3;  motorCommand[FRONT_RIGHT]   = throttle - motorAxisCommandRoll - motorAxisCommandPitch*2/3;  motorCommand[REAR]          = throttle + motorAxisCommandPitch*4/3;  const float yawMotorCommand = constrain(motorAxisCommandYaw,-MAX_RECEIVER_OFFSET-abs(receiverCommand[ZAXIS]),+MAX_RECEIVER_OFFSET+abs(receiverCommand[ZAXIS]));  motorCommand[SERVO]         = constrain(TRI_YAW_MIDDLE + YAW_DIRECTION * yawMotorCommand, TRI_YAW_CONSTRAINT_MIN, TRI_YAW_CONSTRAINT_MAX);}Notice your pitch calc for the rear motor is the same apart from the scaling factor.Your front motor calcs are almost correct except with one you add the roll command and the other you subtract the roll command, since one motor has to lift up while the other goes down.
 17 Using Arduino / Project Guidance / Re: Tricopter algorithm [HELP - CONFIRM] on: December 25, 2012, 01:59:07 am Quote from: freak174 on December 24, 2012, 08:18:25 pmIt may be due to this line.Goes from 0 - 180, maybe I should change it to -180 - 180.Code:myPID_Pitch_Plus.SetOutputLimits(0,180);However if that will fix it, should I make a IF statement (for the roll axis)You shouldn't need an if statement. But yes map the stick values so 0 degrees is center position. So you get positive or negative values when it's rolled to the left or right. And the same for pitch, yaw. Same with sensors - when the tri is perfectly horizontal read that as 0 deg pitch and roll.
 18 Using Arduino / Project Guidance / Re: Tricopter algorithm [HELP - CONFIRM] on: December 24, 2012, 07:56:07 pm I may have missed it, but how are you planning to control yaw?
 19 Using Arduino / Project Guidance / Re: Arduino autopilot Help on: December 22, 2012, 04:13:41 am Is it drifting off-course because it's overshooting the target heading? For example, say it's pointing 90 deg (East) and  the target heading is 0 deg (North). Does it turn anti-clockwise but go too far?
 20 Using Arduino / Project Guidance / Re: Board Application on: December 22, 2012, 03:52:48 am Quote from: PeterH on December 21, 2012, 10:17:12 amIf the thrust vector is offset to either side then the vessel is accelerating in roll and you probably want to try to bring it back into balance.That's why I said use PID controllers. The only problem with that is if the payload (mass) changes significantly, such as a different pilot who ways more, it would (probably) have to use different PID coefficients. Peter, what about using differential pressure sensors to measure ride height like I mentioned? Don't you think that would work?
 21 Community / Website and Forum / Re: Timezone setting in profile doesn't stay saved. on: December 21, 2012, 04:19:15 am Ahh, silly me. I was setting the time offset in 'Preferences', not in 'Forum Profile Information'. What's the time offset for?
 22 Community / Website and Forum / Re: Timezone setting in profile doesn't stay saved. on: December 21, 2012, 04:13:11 am I just tried it on the laptop, telling the site to remember me, closed firefox then opened it again and the timezone was correct. But after logging out and back in it reset back to offset 5 instead of 16. I've cleared cookies etc several times but it keeps happening.
 23 Community / Website and Forum / Timezone setting in profile doesn't stay saved. on: December 21, 2012, 03:37:06 am I searched about this but couldn't find anything. I'm in Australia so set the Time Offset to 16. It works fine at first. But after coming back to the site later on the offset is put back to 5. This happens on both my laptop and desktop. I'm using Firefox on both. Is this a known problem?
 24 Using Arduino / Project Guidance / Re: Board Application on: December 21, 2012, 03:15:41 am Quote from: CaptainTom on December 21, 2012, 01:16:12 amYes, I would very much like it to lean in turns but how with bolt upright electronics.That's what I thought. Have a look at this simulation I did a while ago: I was only animating the target lean angle of the bike. A PID controller took care of applying torque to a motor on the forks, steering to keep the bike at the commanded angle.But in your case, if the 4 foils are independently controlled couldn't you think of it as a quadcopter (with rudder) with altitude and attitude hold? Except for yaw which is manually controlled. Then couple the yaw to roll through a nested PID. It would be fun (and wet) tuning it
 25 Using Arduino / Project Guidance / Re: Board Application on: December 20, 2012, 05:14:10 pm Quote from: CaptainTom on December 20, 2012, 04:26:12 pmAs I said, mechanical sensors are not a candidate for this project.What about using differential pressure sensors to measure the depth of the pod (and therefore height)?QuoteAlso, there is no manual input accept to yaw.So how does it yaw? Won't it have to lean into the turn?
 26 Using Arduino / Project Guidance / Re: Acoustic Thermometer Project on: December 19, 2012, 03:40:08 pm Have you seen this app note?http://cds.linear.com/docs/Application%20Note/an131f.pdf
 27 Using Arduino / Project Guidance / Re: Phone Operated Switch using Arduino on: December 13, 2012, 07:03:17 am And now how do you pick up the phone?
 28 Using Arduino / Project Guidance / Re: Phone Operated Switch using Arduino on: December 13, 2012, 05:08:24 am Quote from: cjdelphi on December 13, 2012, 03:53:39 am I swear i came across an IC which encoded decoded those tones DTMF decoder?Yes. MT8870 is one such IC. Have a read here for some background. And also look at this board.
 29 Topics / Device Hacking / Re: Create a spark or burning coil with Arduino on: December 07, 2012, 02:10:58 am Quote from: cr0sh on December 07, 2012, 12:20:32 amIf you do this, don't fill it with hydrogen in this manner. I agree. Although we used to fill 75 liter garbage bags using a slightly different (but just as dangerous) reaction. Everything was weighed accurately and cold water baths used to control the reaction rate. But I studied chemistry so was aware of the dangers, and what was the quickest way to the shower, and to the hospital. Still a silly thing to do.BTW, hydrogen will ignite over a huge range of O2 concentrations. Even a few percent of oxygen could likely turn your blimp into a bomb.
 30 Using Arduino / Project Guidance / Re: How to control DC motor forward and reverse with one potentiometer on: December 06, 2012, 02:47:48 am If you do decide to make this with Arduino and H-Bridge shields, I wrote this code the other day as a learning experience (I'm new to Arduino) until I realized you wanted a non-MCU solution. Don't have an H-Bridge to test but seems to give proportional bi-directional control. This is just for the "horizontal" motor.Code:int deadZone = 50; // joystick deadzone rangecint maxPWMValue =  255; // maximum PWM value. 255 for built-in PWMint horizPotPin = A0; // Analog pin for horizontal pot senseint horizPWMPin = 9; // Horiz motor speed control connected to this pinrint horizDirPin = 2; // directional control connected here. HIGH = forward, LOW = reversevoid setup(){ pinMode(horizPWMPin, OUTPUT); pinMode(horizDirPin, OUTPUT); // for debugging Serial.begin(38400); }void loop(){ int horizPWM = 0; // holds the pwm output for 'horizontal' motor boolean  forwardDir = true; // direction for 'horizontal' motor. true = forward, false = reverse // read horizontal pot value int horizPot = analogRead(horizPotPin); // map the analog value of 0..1023 to -255..+255 // If the direction and speed go in the wrong direction compared to joystick movement, // just switch the sign of the last two parameters int h = map(horizPot, 0, 1023, -maxPWMValue, maxPWMValue); // check if joy in reverse position if (h < 0) { forwardDir = false; h *= -1; } // only set final PWM output if joy is outside of deadzone range if (h > deadZone) horizPWM = h; // set pwm and direction digitalWrite(horizDirPin, forwardDir); analogWrite(horizPWMPin, horizPWM); //debug crap Serial.print(horizPWM ); Serial.print(", "); Serial.println(forwardDir); delay(50);}
 Pages: 1 [2] 3 4