|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
wiring and programing our optical encoders
hello
we are trying to set up our us first optical encoders. unfortunately there is nothing in the manual that I could find on how to do this task. now I have gone though the chief Delphi forum's and found a article that explained how to set up the encoders. from what it said is that I had to hook up our encoder by getting a two three pin cable and wire them like this ground power signal a then get another cable and put signal b on the other cable on the signal slot and then plug them into our digital side cars now if I have this set up right would anybody know happen to know how I would program this in c++. just to have it output the angle. thank you |
|
#2
|
||||
|
||||
|
Re: wiring and programing our optical encoders
WPILIB provides an encoder class (I believe) that can be used with the encoders.
It should count in "ticks". Not degrees. So you'll have to find out how many "ticks" are in one revolution of your encoder, and use that to convert to degrees. In addition, the encoders are not "absolute" encoders. They do not have a zero-position that stays the same. Essentially, every time you fire up your code the zero will be in a different location. So if you are trying to use the encoders for absolute positioning, you either have to buy an absolute positioning encoder, make sure you set your mechanism in the same location every time and then zero it, or use a potentiometer suited to the application. |
|
#3
|
|||
|
|||
|
Re: wiring and programing our optical encoders
does my wiring look correct i do not know
|
|
#4
|
|||||
|
|||||
|
Re: wiring and programing our optical encoders
Yes it does.
|
|
#5
|
|||
|
|||
|
Re: wiring and programing our optical encoders
hmm i wonder if it is somthing am doing wrong then
this is how i stated my code: I state this inside my main class Encoder encoder(1, 2, true); and then in my teleop loop I say float tick = encoder.GetDistance() ; printf("tick:%4.2f /n",tick ); and what i am getting is tick: tick: tick: .... and when I move my gear box i get no input now i did noticed there is a spot for a jumper on the digital side car on the digital input sides do i need to put a jumper in there. the probem when i do that everything become nonresponsive until i remove it so does anybody know what am i doing wrong |
|
#6
|
||||
|
||||
|
Re: wiring and programing our optical encoders
try
initTeleOp(){ encoder.SetDistancePerPulse(.025); //this actually depends on your wheel size, gear ratio, encoder CPR encoder.Start(); } PeriodicTeleop(){ INT32 tick = encoder.GetDistance(); printf("tick:%4.2 /n",tick ); ) This should get you started |
|
#7
|
|||
|
|||
|
Re: wiring and programing our optical encoders
thank you very much I will try it
|
|
#8
|
|||||
|
|||||
|
Re: wiring and programing our optical encoders
I don't know what "spot for a jumper" you're talking about. Can you describe it more fully? Your program says you have the encoder connected to DIO1 and DIO2. As long as the Digital Sidecar has good power, you shouldn't need to do anything else with the wiring.
|
|
#9
|
|||
|
|||
|
Re: wiring and programing our optical encoders
|
|
#10
|
|||
|
|||
|
Re: wiring and programing our optical encoders
Those are spare power connectors
|
|
#11
|
|||
|
|||
|
Re: wiring and programing our optical encoders
ok so that wouldnt power the digital io you needed jumpers for moters
|
|
#12
|
||||
|
||||
|
Re: wiring and programing our optical encoders
The only time that you need to worry about a jumper on the digital side car (and someone can correct me here if I'm wrong), is when you are plugging in a servo.
What you did with the jumper was to jump power straight to ground - you short circuited the entire board. You are lucky it has built in protection or you would have fried it. Please try to read through the various controls manuals provided by First if you haven't already. They provide a great starting point for someone new at this. Also, try to use punctuation and capitalization. It's hard enough to read through the hundreds of posts - don't make it any harder! |
|
#13
|
|||||
|
|||||
|
Re: wiring and programing our optical encoders
If you connected those two pins together, you shorted power and ground. That would certainly make everything else stop working.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Programing+encoders =? | alaskabas | Programming | 2 | 24-02-2009 20:41 |
| Wiring Gyros and Encoders? | SuspectZero | Electrical | 3 | 03-02-2008 15:30 |
| programing the vex optical shaft encoder | youngWilliam14 | Programming | 10 | 11-11-2007 16:16 |
| Optical Encoders | misterikkit | Robotics Education and Curriculum | 7 | 22-12-2003 23:13 |
| Programming Optical Encoders | GrahamS314 | Programming | 5 | 09-03-2003 08:16 |