View Full Version : CAN Encoder Programming problem
Greycrazygamer
06-02-2013, 23:45
we are designing a pivot drive system this year for our robot, however i am running into some problems with the code. We integrated the example CAN position.vi example from labview into teleop, however, when running the code, our AMS as514sb encoder will go to a certain value, then reset to 0. for example, if i set its position to 2 rotations, it may go to 1.78, then reset back to 0. this produces an effect of the motor continuously running, attempting to reach 2.00, but failing. interestingly, the encoder pulses seems to control the range of value we can move between before the value resets to zero. We are also running a US digital encoder to turn our wheels forward/back and we are having no problems with this encoder. i know the the AMS can utilize must higher pulses per minute than the US, but im not sure if that should effect the code.
Alan Anderson
06-02-2013, 23:55
The AS5145B is intended to be used as a rotational position encoder, not a quadrature encoder. How do you have it connected? How are you reading its value?
ILikePizza555
07-02-2013, 00:14
I'm from the same team as CrazyGamer and we are working together on this.
This is how we wired it:
https://lh4.googleusercontent.com/-r-MOqvmErEw/URM2QXNj1YI/AAAAAAAAAOY/c3BcbSU61x8/s800/photo%25283%2529.JPG
https://lh5.googleusercontent.com/-tl4VmxvHsF0/URM2QQK4wZI/AAAAAAAAAOc/RRMm0nn6RqM/s800/photo%25284%2529.JPG
ILikePizza555
07-02-2013, 00:15
This is how we coded it:
Begin.vi:
https://lh3.googleusercontent.com/-jbYRFJnwUlA/URM3XjPF52I/AAAAAAAAAO0/cpZhPYBLthY/s800/Screenshot_5.png
Cust M. - Open vi:
https://lh5.googleusercontent.com/-12cCEmKMI5M/URM3XYjE3hI/AAAAAAAAAOs/op_UODVPVPk/s800/Screenshot_1.png
Cust. M. - EncodeMotor:
https://lh4.googleusercontent.com/-8Ce6IKEZ4C4/URM3XUkPyCI/AAAAAAAAAOw/8jIpZjDtdvk/s800/Screenshot_2.png
Teleop:
https://lh6.googleusercontent.com/-BbpHMGvwPvw/URM3XSdNokI/AAAAAAAAAO4/7pM9y-ZRY8Q/s800/Screenshot_3.png
Alan Anderson
07-02-2013, 08:08
This is how we wired it:
On the sensor, I see six wires: two red, two white, and two black. On the Jaguar, I see five: one each of red, white, and black, and two gray. What happens to the wires between the two devices?
You apparently have something connected to the "I" (index) pin of the Jaguar's encoder input. A signal on that pin will reset the count. Try just removing that connection and see if the count starts doing what you expect.
ILikePizza555
07-02-2013, 23:01
On the sensor, I see six wires: two red, two white, and two black. On the Jaguar, I see five: one each of red, white, and black, and two gray. What happens to the wires between the two devices?
You apparently have something connected to the "I" (index) pin of the Jaguar's encoder input. A signal on that pin will reset the count. Try just removing that connection and see if the count starts doing what you expect.
The wire leading that plugs into (-) on the Jag gets split into two and goes into gnd and Csn on the encoder.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.