Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   encoders (http://www.chiefdelphi.com/forums/showthread.php?t=32611)

stephenthe1 12-01-2005 22:50

Re: encoders
 
is that already in the default routine, because our compressor doesn't automatically turn itself on. plus, if you read my above post, are you sure the default settings work with the way my bot is configured? thank you.

gnormhurst 12-01-2005 23:05

Re: encoders
 
I have some vague recollection that you may not pass inspection if you do not have the pressure limit switch controlling the compressor.

Last year we were overweight and removed our compressor, opting instead to charge the air tanks before each match.

thoughtful 13-01-2005 00:30

Re: encoders
 
Sorry if this is a bit off topic.

I was looking through the encoder the Mr.Kevin provides on his website. I did not find the model of the encoder he was using, i am currently wanting to use optical encoder from digikey there a lot of them available. I am trying to decide which one to buy and will the optical encoder just tick when the dark area changed to light?

Thank you in advance

Anthony Kesich 13-01-2005 01:16

Re: encoders
 
Quote:

Originally Posted by gnormhurst
I have some vague recollection that you may not pass inspection if you do not have the pressure limit switch controlling the compressor.

Last year we were overweight and removed our compressor, opting instead to charge the air tanks before each match.

I believe it is the pressure blow off valve that cannot be removed, not the pressure sensor. In 2003, we ran without a sensor. That's where CJO got the code from. We used the wheel since we didnt have any more buttons on the controller to map the function to. We controlled it manually since we were having power regulation problems and decided to kill the compressor completely for the last 30-45 seconds of the match.

-Tony K

Kevin Watson 13-01-2005 01:30

Re: encoders
 
Quote:

Originally Posted by thoughtful
...I was looking through the encoder the Mr.Kevin provides on his website. I did not find the model of the encoder he was using...

From the readme.txt: "This software was tested with Grayhill 63R256
and 61K128 quadrature output optical encoders. Data sheets for
these devices are included."

-Kevin

CJO 13-01-2005 01:35

Re: encoders
 
As Anthony points out. If you have power to burn, leave the compressor in full auto, if, on the other hand, you want manual control (for any one of a number of reasons) I think that the wheel is a good choice, as it is convienient, and hard to press by accident.

stephenthe1 13-01-2005 07:15

Re: encoders
 
Quote:

We're still looking for a description of the symptoms.
actually, our encoder does work, it's just a matter of finding if the code works or not. if not, then there is an encoder problem. however, I checked the wiring. I heard there's a way to see every time it clicks on the laptop. how's this done? also, yes, I've gone over the read me.

Greg Ross 13-01-2005 13:51

Re: encoders
 
Quote:

Originally Posted by stephenthe1
actually, our encoder does work, it's just a matter of finding if the code works or not. if not, then there is an encoder problem. however, I checked the wiring. I heard there's a way to see every time it clicks on the laptop. how's this done? also, yes, I've gone over the read me.

Here's what I would do to verify that your encoder is working: In the routine where you are controlling the arm, add the following code:
Code:

int tempEncoder;
static int prevEncoder = 0;
...
tempEncoder = Get_Left_Encoder_Count();
if (tempEncoder != prevEncoder) {
  printf("%d ", tempEncoder);
  prevEncoder = tempEncoder;
}


stephenthe1 13-01-2005 14:37

Re: encoders
 
Quote:

Originally Posted by gwross
Here's what I would do to verify that your encoder is working: In the routine where you are controlling the arm, add the following code:
Code:

int tempEncoder;
static int prevEncoder = 0;
...
tempEncoder = Get_Left_Encoder_Count();
if (tempEncoder != prevEncoder) {
  printf("%d ", tempEncoder);
  prevEncoder = tempEncoder;
}


which screen will it print to when running the program? I know in the link cable program thing to download the (ifi loader) program, there's a little screen.
is it in that?
that would be hard to trace, because it prints out hundreds of lines, and there isn't a way to print or save it to a file for viewing. guess I can search it. thanks!

also, I don't know if it matters, but what are the three "..." periods for after the previous static encoder.

stephenthe1 13-01-2005 14:42

Re: encoders
 
also, it says there's an error on this line when I put it in user routines fast.
int tempEncoder;

what's up with that?

Greg Ross 13-01-2005 16:38

Re: encoders
 
Quote:

Originally Posted by stephenthe1
which screen will it print to when running the program? I know in the link cable program thing to download the (ifi loader) program, there's a little screen.
is it in that?

Yes. that's where you'll see the output.

Quote:

that would be hard to trace, because it prints out hundreds of lines, and there isn't a way to print or save it to a file for viewing. guess I can search it. thanks!
That's why my code only prints the encoder value when it changes. It will still move pretty fast when the encoder is turned, but it will stop when the encoder stops. Also in order to keep as much of the data on screen as possible, I intentionally didn't print a newline.

Quote:

also, I don't know if it matters, but what are the three "..." periods for after the previous static encoder.
Those were just intended to show that there were lines omitted.

Quote:

also, it says there's an error on this line when I put it in user routines fast.
int tempEncoder;

what's up with that?
Sorry. I guess I could have been a little more specific. The first two lines need to go at the beginning of the function. In C (unlike in C++), data definitions must appear before any executable statements in a function.

Leave out the ellipsis (the "..."), and then put the rest of the code just before the arm control code.

stephenthe1 13-01-2005 16:45

Re: encoders
 
the encoder is working!!! thanks for the help in this thread. I'm still looking at our compressor, though it's not a pain to enable, just that they have it wired oddly. thanks again!

Greg Ross 13-01-2005 19:37

Re: encoders
 
Quote:

Originally Posted by stephenthe1
the encoder is working!!! thanks for the help in this thread. I'm still looking at our compressor, though it's not a pain to enable, just that they have it wired oddly. thanks again!

Congratulations! Does that mean the arm is working too?

Earlier, you said
Quote:

ok, our compressor is hooked up to digital 17. from last year's white sheet with the different wires labeled, it says that the sensor for the relay is hooked up to analog 1. I'm new to the compressor stuff. Is this all of what you need to write the code for it? It is hooked up to a spike. unless this is hard, could you show me the code for this, and tell me where to put it. That would allow me to learn from it as I get confused easily when I have to write things on my own without experience. as soon as you can is best, as I'm at a robotics meeting right now.
thank you for your help,
Stephen
Did you mean the compressor is on relay 17? And did you really mean analog 1 for the pressure switch? If so, is it the pressure transducer (an analog pressure sensor) or the (digital) pressure switch?

The default code expects the compressor to be on relay 8, and the pressure switch on digital 18. If you hook up your compressor and pressure switch this way, you're golden. These lines in Default_Routine() in user_routines.c will take care of the compressor:
Code:

  relay8_fwd = !rc_dig_in18;  /* Power pump only if pressure switch is off. */
  relay8_rev = 0;

If you really are using the pressure transducer, and you want to leave the compressor on PWM 17, you will need to add some code that I'm not prepared to help you with right now, since we haven't used any analog inputs on the robot since we have gotten the new controllers.

BTW, I think that last year, the ruling was made that even if you want to use the pressure transducer, you still have to have the digital pressure switch. If this is the case (and you still want to leave your compressor on relay 17), you will need to change the line in Default_Routine() to
Code:

  relay17_fwd = !rc_dig_in18;  /* Power pump only if pressure switch is off. */
  relay8_rev = 0;

(Change rc_dig_in18, if necessary, to whatever digital input you connect your pressure switch to.)

roboticsjenkins 04-02-2005 18:55

Re: encoders
 
On getting the Phase A/ Phase B hookup on the encoder. Do i need to splice the wires. Do i have just one pwm for each encoder or two? Please Help....

Alan Anderson 04-02-2005 21:38

Re: encoders
 
Quote:

Originally Posted by roboticsjenkins
On getting the Phase A/ Phase B hookup on the encoder. Do i need to splice the wires. Do i have just one pwm for each encoder or two? Please Help....

Encoder signals go to digital inputs on the RC, not to pwms. Quadrature encoders require power and ground, and they provide two digital signals.

If you're using interrupts, you're pretty much required to use the first two digital inputs for the "A" phase outputs of two encoders, with the "B" phase outputs on two other digital inputs.


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

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