Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   General Forum (http://www.chiefdelphi.com/forums/forumdisplay.php?f=16)
-   -   Labview help: How do you use a gyroscope to level something controlled by two motors? (http://www.chiefdelphi.com/forums/showthread.php?t=126485)

Ragingenferno 15-02-2014 00:33

Labview help: How do you use a gyroscope to level something controlled by two motors?
 
1 Attachment(s)
Hello,

I'm from team 3053 and I’m asking for help making an auto leveling system for our part on our robot. It is kind of like a scissor lift. We are using two motors to control it.

Can someone assist me in doing this please. I attached our code that we have right now.

So basically, we have two motors, one is controlling the right side, one is controlling the left side. When both motors are moving, the "scissor lift" like mechanism raises. We wanted to attach a gyroscope to the bottom of it to automatically adjust the speed of the motors as we manually raise it with a button.

How can we do this?

xXhunter47Xx 15-02-2014 02:10

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
What you're describing seems better suited for motor encoders.

Ragingenferno 15-02-2014 02:17

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
I still wouldn't know how to do that. Could you describe or give me an example?

xXhunter47Xx 15-02-2014 02:19

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
To be completely honest, we're in that hole too.
What kind of motor controllers are you using for the motors? Jags or Vics or Talons?

Ragingenferno 15-02-2014 02:31

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
For the small andymark motors for the lift system we are using victors. I know how to do most things for controlling the robot just not the advanced things like using a gyro to stabilize things.

Brandon_L 15-02-2014 02:33

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
Are you just trying to get both motors to raise the lift evenly?

Ragingenferno 15-02-2014 02:37

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
Yes, pretty much but controlling both motors from the same PWM isn't working out as we expected because the load on top isn't centered. That's why I thought of using a gyro to fix it.

xXhunter47Xx 15-02-2014 03:01

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
Interesting. Encoders as far as I know have to be on Jags.
Now what you could try doing is setting each motor with different output speeds and twiddle with that.
IE if one is going faster, slow it down a little and speed the other one up in labview.

Ragingenferno 15-02-2014 03:09

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
That would work but we are not certain how the ball will land on the lift. The lift will hold our ball along with pneumatic pistons. I think you get the idea of what we're doing there.

So gyro's in labview is that hard?

xXhunter47Xx 15-02-2014 03:18

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
Not necessarily. I would write (I mean draw) an example for you but it's late and I don't really have the time to. Check out team 358's website on labview though, they have great examples that we've been utilizing.

Ragingenferno 15-02-2014 03:23

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
Okay no problem.Well, I already know how to code for gyros and things of that nature. I just don't know how to utilize the data it sends back as a variable and unfortunately the site(or at-least i couldn't find) doesn't have an example for that.

lucas.alvarez96 15-02-2014 08:17

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
First off, encoders don't NEED to be on Jags. You can just hook their A and B pins (and index if necessary) to the Digital Sidecar DIO pins. Concerning the mechanism, I'd say a potentiometer would be your best bet. In java, you can declare a pot with various parameters, allowing you to change the 0V to 5V range to something easier to work with, such as 0 to 270 degrees. And finally, once you have your sensor, I'd recomend a PID loop using degrees as your input units.

Ragingenferno 15-02-2014 08:24

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
I have almost no clue what you just said. I'm not using java although I do know the basics of it. I'm using labview as I wasn't given a chose.

A potentiometer? I don't see how that would work. I'm trying to keep something level, as in, level to gravity.

Mark McLeod 15-02-2014 08:28

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
What you need is a PID control driven by your gyro.

For a simple approach I'd start with setting one motor speed to below maximum, e.g., control it directly with a joystick but cap the maximum at .8
That gives the other motor a little room to run faster or slower than the first motor while trying to keep things level.
Then use PID just on the second motor to keep the gyro level.

The right half of this example below.
Replace the "What we want the pot to read" with your target gyro reading.
Replace the "What the pot currently reads" input with the current gyro reading.
The target reading might be taken when the platform is down and level before it starts to rise.

You will need to adjust the PID coefficients by experimentation. Keep I & D zero and just play with P (start P at 1 for the first test and gradually increase it) until you get the platform to remain steady (but probably a little tilted) all the way up.
Then start playing with I to level the platform out (start with a small number like .1 and decrease it).


Chadfrom308 15-02-2014 08:40

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
I would start by creating a pid where the output to the motor is negative if tilted one way, and positive if tilted the other way. Then you could split the output of the pid and drive each side based on whether it is positive or negative. You probably would want to take it a step further and make one motor output the inverse if the other, so that now the scissor lift doesn't just go up

Ragingenferno 15-02-2014 08:50

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
Okay, thanks. I'm actually going to robotics now and I will try and see if I can get it to work. I'll update you guys soon :)

Greg McKaskle 15-02-2014 10:27

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
What some of the previous posts are pointing out is that you need some feedback element, and a gyro isn't your only choice. A pot, or potentiometer is basically like the knob on your stereo, or something that still has analog knobs. It relates a voltage to a position. There are a variety of them to choose from, but they are one approach and benefit from generally having an absolute value for each position of your mechanism.

Encoders count up and down as their shaft is turned CW or CCW. They generally don't have an absolute number for a given position, but have work great when something is turning many revolutions and you want to know how far it has turned.

The gyro can be used to how much something has turned since it was inited, but they drift over time.

Accelerometers can measure the force of gravity and can help level mechanisms as well, but they tend to lag and are subject to other forces such as bumps, uneven ground, and driving forces.

All of these provide feedback to your code. In your code, you can implement any number of control approaches. Bang-bang is perhaps the simplest, but I'd think that a simply proportional control would be just fine for you. You will send a PWM value, say 0.5 to both motors, but a bit later you will measure each side to see if one is ahead of the other. You'll take that error amount and use it to slow one down and speed the other up by some proportional amount. Rinse/repeat. This will help to correct for binding and friction and other forces that make one side go slower than the other. You can make this yourself or use the PID VI with only P being nonzero.

The biggest tip I can give is to plot your motor values and the feedback on your panel. Once you implement the control, also plot your error term. This will help to see whether problems are due to feedback noise, lag, or control values. It will also help you realize the type of binding or other issues that are forcing the motors to operate at different levels. The plotting is accomplished by bundling the values together into a cluster and wiring that to a stripchart on your panel. You can change the X scale to show more or less data, and you may want to turn off the Y autoscaling once you know the range of numbers you'll be plotting. You may want to stack the plots or make additional Y scales if the numbers are vastly different ranges.

Greg McKaskle

Ragingenferno 15-02-2014 18:08

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
Thanks for your tips. I will be sure to try everyones ideas but I have another problem. I tried today to control both motors from the same PWM output. I used a 3 pin spitter that normally comes with the kit. When I did this, only one of the victors was receiving code. The other one wasn't. I even tired switching the cable to see if it was at fault. I couldn't get the PWM signal to split.

Is this normal? Can you actually split a PWM signal?

Alan Anderson 15-02-2014 21:06

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
Is there any way you can physically link the two sides of your lift, so you don't need to use software to coordinate the motors? That would be my preferred solution.

Greg McKaskle 15-02-2014 21:11

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
Does the Digital breakout have 12V power connected to the PD? Are the LEDs bright?

Greg McKaskle

Ragingenferno 16-02-2014 02:34

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
I tried today to control the two motors from one PWM signal. But when i used the splitter, only one victor was receiving code. The other was not and I even tried switching the cables and the victor with a new one. My Digital side car is plugged into the 6 volt connector on the power distributor.

My solenoid break out, and analog breakout has a direct 12 volt from the power distributor.

So, why doesn't splitting the signal work? Am I doing something wrong?

Alan Anderson 16-02-2014 12:59

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
Quote:

Originally Posted by Ragingenferno (Post 1343849)
My Digital side car is plugged into the 6 volt connector on the power distributor.

The Power Distribution Board does not have a 6 volt connector. Do you mean the 5 volt output? That's intended for the camera. Do you mean the boosted 12 volt output? That's intended for the D-Link "robot radio" (by way of the 12v-to-5v converter).

The Digital Sidecar must get its power from a regular battery connection on the Power Distribution Board, protected by a 20 A snap-action circuit breaker.

Ragingenferno 16-02-2014 19:17

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
Quote:

Originally Posted by Alan Anderson (Post 1343992)
Do you mean the 5 volt output?

Yes, I meant the 5volt connector. Thanks for the heads up, I will be sure to switch it to the Power distributor. Do you think that will fix the problem of the signal not splitting?

Alan Anderson 16-02-2014 20:18

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
Quote:

Originally Posted by Ragingenferno (Post 1344153)
Do you think that will fix the problem of the signal not splitting?

Yes.

You weren't giving the Digital Sidecar enough voltage for it to do its job. It was able to sip enough from the cRIO through the ribbon cable to barely control the speed controllers, but I would expect that they would stop working if you ran enough of them in reverse at the same time.

Ragingenferno 16-02-2014 20:25

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
Yay. Okay great, one problem solved.

I'll know that for our girls robot. We have two teams unfortunately and the girls don't really help out on there own robot.

So now lets say I still want to use the gyro, but just to get a read to tell the driver that the top is indeed level. How would I wire it?

I believe I have the programming part of the gyro complete.

Alan Anderson 16-02-2014 20:53

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
A gyro isn't going to tell you whether anything is level unless you have another method to make sure it's level at some point. But if you can do that, just wire it the normal way: connect the Rate pins to either Analog Input 1 or Analog Input 2.

A dual-axis accelerometer can measure the direction of gravity. It might be a better sensor, assuming you can ensure that the robot won't be bumping around much while you're trying to use it.

Ragingenferno 16-02-2014 20:59

Re: Labview help: How do you use a gyroscope to level something controlled by two mot
 
If the gyro is level and the platform that it is connected to is parallel to the gyro, that would give an accurate read right?


All times are GMT -5. The time now is 18:33.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi