Controlling Tricopter esc's
teganburns
Posts: 134
Working /w my tricopter i need help finding the right object to control the ESC's.
I need to make a 51Hz pwm signal with a 5 to 7 duty cycle.
Now here is the catch all of the object that i have found only give me a 5, 6, or 7 duty cycle and i need 5.1 & 6.4 ect. to control the motors accurately.
If I could control it down to the hundredths or thousandths place that would be even better!
Thanks in advance!
I need to make a 51Hz pwm signal with a 5 to 7 duty cycle.
Now here is the catch all of the object that i have found only give me a 5, 6, or 7 duty cycle and i need 5.1 & 6.4 ect. to control the motors accurately.
If I could control it down to the hundredths or thousandths place that would be even better!
Thanks in advance!
Comments
I uploaded code("Example") that uses the FREQOUT_X31.spin object. (shows "duty")
Duty cycle is explained here -->http://www.youtube.com/watch?v=FKKcVR-2a1I
Servos and ESCs don't use duty cycle for control, it's the pulse length that's important.
As Rich says, use the Servo32 object for both servo and ESC control.
What Propeller board are you using?
Do you need to read the pulses in from the receiver?
I think Servo32v8 is the most current servo driver object, Servo32v7 is included with the Propeller tool.
I CAN control a servo with the propeller, do i completely understand the full concept... not quite.
I'm using the Prop plug.
and i read the pulses from the receiver using "_FreqCount.spin"
I added pictures and data to help clarify.
If you could post a link that would be awesome!
It's impossible to find anything in OBEX with all the old links broken
Good, that makes using an ESC easy. The off state uses a pulse that would turn the servo all the way clockwise (1000us or so (if can vary)). Full throttle would use the same pulse as moving the servo all the way counterclockwise (2000us or so).
Like servos the pulses should be sent 50 times a second (servo32v9.spin takes care of this for you).
I'd suggest using Cluso99's object or the object I linked to to read in the pulses.
(BTW, I think that's a Prop Stick. A Prop Plug is used to program a Propeller board that doesn't have its own USB connection.)
IIRC, you have a QuickStart board. You could test out your ESCs with my QuickStart servo tester program. Connect the signal line to on of the pins between P8 and P15 (inclusive) and watch the terminal window as you adjust the pulse length. Post #2 of the thread has instructions on how to adjust the pulses and end points (you probably don't need to adjust the endpoints for an ESC).
http://forums.parallax.com/showthread.php/136897-QuadCopter-(Tri-Quad-Hex-Octa)-propeller-chip-code-discussion?highlight=quadcopter
The above thread followed on here...
http://forums.parallax.com/showthread.php/133372-Ken-Cluso99-W9GFO-JasonD-s-QuadCopter-Build-Log-(updated-info-ELEV-8-availability)?highlight=ken+quadcopter
And here is my OBEX servo driver (uses the PC keyboard)
http://obex.parallax.com/object/225
I wanted to correct the above statement. Apparently many ESCs work well with a higher refresh rate than 50Hz. Jason Dorie's quadcopter code uses 250Hz refresh rate on the ESCs.
Now that I think of it, I seem to remember Rich telling me many ESCs can make use of a higher refresh rate than normal servos. Servo32v9 will still work with ESCs but if you want to use a faster refresh rate you can use the object in Jason's program (its name is Servo8Fast.spin). It's not a drop in replacement for Servo32v9 so make sure to read the comments to see how to use the object.
And i have ran into another bump in the road that i will need help with.
I am messing around with the code and can't get multiple esc'c running.
I am not very fluent with the PASM language.
I have attached the altered code, with notes, that i have so far.
Thanks all
The objects I mentioned in post #14 would be a better match for your application IMO.
Do you have a servo to move the third motor? Tricopters need one of the motors to be able to rotate in order to control yaw. There a different beast than quadcopters.
Besides controlling the three ESC, you also need to control the position of one servo.
I'd think it would be easier to make a quadcopter than a tricopter.
I tried to use the servo8fast program before but couldn't figure out what to set for the parameters. I looked at the "Main - Hoverfly open" object but there was a simple error in the code when i attempted to compile it to the prop.(guess i gave up too quickly)
All in all I fixed the error and looked at the program more closely and all esc's and the servo are working! (Yay!!)
The reason i made a Tricopter over a quad is the Yaw movement makes outdoor maneuvers and obstacle avoidance far easier.
Uh, quads can yaw, I don't understand the reasoning,
Compared to a quad you need to reduce the speed on some props while increasing the speed on other props to get the same motion.
And if you are in flight moving forward all of this becomes more complex and tends to be more difficult to make smooth.
This clip shows a quad running the code that Duane posted the link to.
Watch it yaw at about 15 seconds in:
[video=youtube_share;do0gaTNWtpU]
Granted, a tri will yaw quicker, but you may need to compensate for the drop in lift as you tilt the propeller over, or your tail will drop a bit. The Servo8Fast code will handle a tri with no problems. If you're running an analog tail servo, be sure to use AddSlowPin to set the output pin for it. The ESCs can all be set with AddFastPin.
I don't think the drop in lift for the rear motor will be a big issue but its definitely something that i will need to consider when writing and testing programs.
Servo8Fast looks like it will be spot on for controlling the tricopter thanks!
Gonna run some tests and get some ideas going and write some more programs tomorrow during the day.
As for the servo I have a digital all metal gear servo and the AddFastPin method worked like a charm.
if( FrameConfiguration == 0 )
Change the code under that to this:
...and also remove the if(FrameConfiguration) thing and else case altogether. You'll probably need to change the OUT_xx consts to match your outputs, too.
I haven't actually *tried* this, but I've been itching to do it.
I think i may have done this, so i ordered a esc programming card for my type of esc because i know i messed it up trying to manually reprogram the esc...
Rather just spend ten dollars to save some time and effort and I have a feeling that i might do this again.
is that you should have way more then 50Hz update more like 500-800Hz. So you need some better esc or you will deal with a lot of woublle in flight
Get some esc what can be reprogramed with the SimonK firmware (best esc firmware there is ...).
I have some multistar esc von Hobbyking and reflashed them with the simonK firmware, and they run way smother then the original firmware what already is for quadcopter.so my esc
went from 499Hz stock to 800 and wow what a big diffrence.
Beside of that i just wait at the moment for my pcbs to arrive and then i will thest the prop version of a multiwii/Crazyfly gcc port to prop gcc
As soon i have some code cleaning done i will post it here
MfG
Oliver .R
I hear people say all the time that you should run your ESCs at 400 Hz or higher, but I've seen lots of quad and tricopters that were quite stable using off-the-shelf rate gyros, and those only run at 50 Hz. I'm not saying that a higher frame rate won't help, but I don't think it's the holy grail people seem to think it is. Maybe *with* the SimonK flash it'd make more difference.
First video is showing the difference between a standard ESC and the same ESC flashed with SimonK. Note that the thing he's testing it with is just a standard servo tester, so it's only outputting a 50 Hz signal:
This video shows a similar comparison using a heading lock gyro to control the ESC, first with a normal flash, then with SimonK, but it's using the same frame rate in both cases. In this case it's a high-rate gyro, so it's probably running at 280Hz:
I'm sorry but I think this is nuts. I love to know who started this rumour and what evidence there is to back it up.
There are a few things which make me think this is pointless:
1) There is no point driving your control outputs at a faster rate than the rate at which you sampling your sensors, gyro etc. This does not make the control loop react faster. In fact I think it might create more problems than it solves.
2) What about the inertia of the motor and propeller? There is no way the props can change speed, hence thrust, at 500Hz. I bet if you measured the propeller speed whilst giving the ESC a blip of full power lasting 2ms you would hardly see it respond. Consider how small and light a loud speaker cone is to reproduce sound at 500Hz, do you really expect your motor and Prop mass to be able to respond at that speed?
3) What about the inertia of the entire copter. Even if the motor could go from zero to full thrust for 2ms and back again I bet you would hardly see the copter twitch.
What we have is a control feedback loop from sensor to processor to ESC to motor to copter movement back to sensor. There is no point in running one link in that chain ten times faster than all the others can respond.
I would imagine that the lowest possible control loop frequency might have advantages in keeping noise out of the system.
If anyone has done any tests that contradict my assertions I would be glad to hear about them.
Faster is probably better, but only to a certain point, and I am not sure what that point is.
Just my 2 cents
That's my theory and I'm sticking to it.
I didn't get the idea of a tricopter having it's motors further apart so as to get a better camera view either. What's that about? If you want the motors further apart put them further apart. Anyway surely a tri is harder to design and control than a quad as the rotational forces are not balanced nicely?