I was having IMMENSE problems with the Digital Encoders trying to read them through a simple DIO method in Java, I tried to write my own using sampling methods over time and ended up in even more of a mess.
I was told by the lead mentor of team 342 that they use CAN control through the Jaguars and they get a very reliable rate through the CAN on the Jaguars.
…I’ve never heard, seen, any documentation or anything on CAN and tried google-ing and got very vague documents.
PLEASE HELP!
I would think most programmers know electrical too so if you could explain how to connect the CAN to the cRIO that would be amazing.
I code in Java as well so examples of this would help as well.
http://www.chiefdelphi.com/media/papers/2433
Excellent whitepaper above on getting started with CAN.
Why not use the encoder classes? They use the FPGA to process the encoder data.
HTH
Beat me to the punch.
I reccomend it as well but some would call me biased…
They are absolutely horrible. In every way. They do not function properly at all.
By horrible I mean. There something seriously wrong with them. I’ve had other teams test it and they came back with the same results as me.
Absolutely horrible is a pretty strong sentiment to place on something. This is a good opportunity to practice troubleshooting the elements you are using and tracking down the issue.
If you were reading them as digital inputs and doing your own logic for advancing or reversing the position, that should work if done properly, but it will only work for a slow progression. I suspect you are reading the pulses every few ms at best, and probably more like every 20ms +/- 5. If you have a 1024 pulse encoder, the 20ms sampling rate would start to fail at something like 1/80 rpm I think – not very fast. By comparison, the fpga reads the digital inputs at a rock steady 6.xxx microseconds. I don’t remember the number, but that is actually limited by the bus access time for the module. With a faster module, it could go far higher.
My initial advice would be to make a small test project using just an encoder example. spin the encoder by hand. If it is flaky, make sure that the issue isn’t with the wiring, the digital breakout, or the sensor. Being the programmer, you are often the first to see that the system doesn’t work, and since the system is complex, the issue could be any number of places. Being able to isolate parts of the system and determine if they are at fault is a valuable technique, and is actually fun once you become good at it.
Greg McKaskle
The CAN bus and the Jaguars are a unique challenge. Many of the problems you’ll see can be overcome fairly easily (once you find them)…but not if you’re in a hurry. I don’t encourage anyone with limits to their patience or available time to try them casually. You’ll end up REALLY disliking them if you plan poorly for this and possibly a bit unfairly to them in general.
That being said…I don’t advise people to fall asleep in: datasheets, on robots or in the box of the KOP. These would seem to be the places you’ll most likely wake up and discover CAN. Safety first you know.
The only error I had been having is lack of connection to the cRIO. I can talk to it from the computer fine, but the cRIO Java implementation gives me an error message about the CAN interface not connecting. Otherwise, it seemed pretty self explanatory. (No, still haven’t fixed it, nothing on the error message around).