|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||
|
|||
|
[FTC]: Motor Encoders
We are atempting to create a code for motor encoders, but we can not find a VI that does this or any place to tell us how to do this. Can anybody give us some directions or sample code?
|
|
#2
|
||||
|
||||
|
Re: [FTC]: Motor Encoders
Can this be in robotC or can it only be for labview?
|
|
#3
|
|||
|
|||
|
Re: [FTC]: Motor Encoders
Alyssa,
I can't help with LabView, but in general, I'd say look for a variable/attribute in the motor block with 'Encoder' or 'Count' in the name. Jason, How are you trying to use them? Through the standard HiTechnic interface, you can access a variable in RobotC named 'nMotorEncoder[]'... Find a file in your (this was RobotC 2.xx) distribution of sample programs: C:\Program Files (x86)\Robotics Academy\ROBOTC for MINDSTORMS\Sample Programs\NXT\TETRIX Motors\TETRIX nMotorEncoders Example.c and see this code: Code:
task main()
{
nMotorEncoder[motorE] = 0; //clear the TETRIX encoders in motors D and E
nMotorEncoder[motorD] = 0;
while (nMotorEncoder[motorE] < 1440) //while the encoder wheel turns one revolution
{
motor[motorE] = 30; //turn both motors on at 30 percent power
motor[motorD] = 30;
}
motor[motorE] = 0; //turn both motors off
motor[motorD] = 0;
wait1Msec(3000); // wait 3 seconds to see feedback from the debugger screens
// open the "NXT Devices" window to see the distance the encoder
//spins. The robot will coast a little bit.
}
Last edited by kz2zx : 15-10-2011 at 16:08. |
|
#4
|
||||
|
||||
|
Re: [FTC]: Motor Encoders
Hi,
Yes, that is what I was going to suggest for her to do - I actually was asking her if she would be allowed to use robotC and then was going to tell her that, I did already know how to do that ![]() But you just made my life easier and told her. And yes, that is exactly what to do. If you need help with labview, I can ask someone else on my team who uses it sometimes, and will try to get you an answer by tuesday |
|
#5
|
|||
|
|||
|
Re: [FTC]: Motor Encoders
We use Labview.
|
|
#6
|
|||
|
|||
|
Re: [FTC]: Motor Encoders
DC Motors with encoders can be used in LabVIEW through three VIs on the "NXT Robotics >> TETRIX" palette.
Move a Fixed Distance : Starts motors running at constant speed with a target encoder count. You can also specify timeout conditions. Motor Status: Returns the current encoder count and whether the DC controller is in the middle of a move to position command. Reset Encoders: this ones pretty simple. |
|
#7
|
|||
|
|||
|
Re: [FTC]: Motor Encoders
Team #116 is using a torque-limiting clutch (FTC Robotics: Tips, Tricks, Strategies & Secrets, Teams #247 & 248) and would like to install an encoder after the clutch on a standard Tetrix 3/16" shaft. Can we use a US Digital E4P-360-188-D-H-D-2 encoder on a shaft instead of a standard Tetrix motor encoder? The only difference is the shaft size and mounting screws.
|
|
#8
|
|||||
|
|||||
|
Re: [FTC]: Motor Encoders
Quote:
|
|
#9
|
|||||
|
|||||
|
Re: [FTC]: Motor Encoders
Quote:
eg: On the driving portion of the code, on the move motors VI, change the Polymorphic selector (small oprion box under the move motor VI) from Power to Speed. Assuming you have the encoder and motors wired correctly, this will enable you to get MUCH finer control of the driving. eg: with constant power, it's hard to get a slow move. You always need to have a certain amount of power just to get the motors to overcome friction (eg 20%). However if you use Constant Speed, (with encoders) you can get the speed as low as you want (eg: 5%) and it ALWAYS runs at that speed, regardless of friction. It's great for slow turns etc. If you try using encoders and you always seem to go at 100% speed, then you have a wiring problem... Could be your encoders and motors are switched, A-B and B-A or mayve your motors are wired in reverse (red -ve, black +ve) |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|