|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Use a button to make a motor move a certain number of rotations
What is the number of pulses per rev for the built-in encoders? I think the only legal motors that have built-in encoders have 7 pulses per revolution and a 71:1 step down through the typically attached gearboxes. Are these the ones that you are using?
If so, that could correspond to 7 x 4 x 71 = 1988 counts per revolution. The factor of four is because the encoder is quadrature, and has four registered pulse edges per pulse cycle. That means you would be seeking a count of approximately 7475. The math changes if you are using a different gearbox. Note that the numbers I am using are integers. You can't have fractional pulses. All of this assumes that you set the output type as position in Begin.vi, and that you have appropriate PID terms. |
|
#2
|
|||
|
|||
|
Re: Use a button to make a motor move a certain number of rotations
Quote:
|
|
#3
|
||||
|
||||
|
Re: Use a button to make a motor move a certain number of rotations
You would put it as an input to the drive (where you have it), but you have to have the drive motors properly configured. One other thing, is that you need a little more logic to latch the value. The Teleop.vi runs approximately every 20 ms. As soon as you let go of the button, your input will be to drive the motor back to the 0 position. This isn't what you want.
If you intend to drive your robot completely with position commands, you will need a state machine that keeps track of the current values, incrementing and decrementing the intended position. It is much easier to drive in speed or voltage mode. |
|
#4
|
|||
|
|||
|
Re: Use a button to make a motor move a certain number of rotations
Quote:
|
|
#5
|
|||
|
|||
|
Re: Use a button to make a motor move a certain number of rotations
Ok I think I'm starting to understand this, so would I put the 7475 number as distance per count in begin for the encoder? Past that I'm not sure how I can assign a button to work under that motor count for the encoder and the motor in teleop
|
|
#6
|
||||
|
||||
|
Re: Use a button to make a motor move a certain number of rotations
Can you post the snippet of code from Begin.vi where you setup these motors?
|
|
#7
|
|||
|
|||
|
Re: Use a button to make a motor move a certain number of rotations
Quote:
![]() |
|
#8
|
|||
|
|||
|
Re: Use a button to make a motor move a certain number of rotations
Quote:
![]() ![]() |
|
#9
|
||||
|
||||
|
Re: Use a button to make a motor move a certain number of rotations
Your snippets are illuminating.
OK, here's the rest of the story. Unfortunately, you won't have a simple way of just sending a number to the motor controller, as you are using PWM Victors, which have no understanding of encoders or close loop modes. You will need to implement a PID control in LabView, where the encoder inputs are compared to your desired position. The outputs will drive the motor voltages up and down, until the desired position is realized. LabView has several built-in PID functions, and there are many threads here about how to use them. |
|
#11
|
||||
|
||||
|
Re: Use a button to make a motor move a certain number of rotations
Quote:
You are quite correct. Those chunks of screenshot carry the same human-readable info, which is what I was after. |
|
#12
|
|||
|
|||
|
Re: Use a button to make a motor move a certain number of rotations
Quote:
|
|
#13
|
||||
|
||||
|
Re: Use a button to make a motor move a certain number of rotations
Quote:
The motors themselves don't have any intelligence. Their inputs are only the voltage applied to the wires. The encoders are not linked in any way to the windings in the motor. You have setup some DIO channels to take the A and B data from the encoders. This information goes straight into the roboRio, which has to do something with it, to control the input to the victors. The roboRio is the brain in this case. The new Talon SRX's are intelligent, and can do the work onboard with no involvement of the roboRio. The older Jaguars had promise of this, but in practice, they rarely worked as designed for encoder-driven closed loop feedback. I have trouble finding the right words to describe how much I LOVE the Talon SRX's closed loop modes. |
|
#14
|
|||
|
|||
|
Re: Use a button to make a motor move a certain number of rotations
Quote:
|
|
#15
|
|||
|
|||
|
Re: Use a button to make a motor move a certain number of rotations
Ok, I think we're just gonna have it where when we press the button it will just run for however long we need it to run, will that work?
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|