![]() |
Problem using encoders on Jaguar
1 Attachment(s)
We have a quadrature encoder wired to the encoder inputs on the Jaguar, yet niether the TI utility, bdc-comm nor labview can use the jaguars in speed mode. In the bdc-comm utility, the option to use encoders is grayed out (see picture attached). Controling the jaguar and motor via Voltage mode works perfectly, but controling it via speed or position mode does not. does anyone have any ideas on how to fix this problem?
|
Re: Problem using encoders on Jaguar
I couldn't see in your picture, but I assume you switched over to speed mode.
What this sounds like to me, if everything is hooked up correctly, is that you did not set your P, I, and D constants. With them at the default 0, your motor won't turn no matter what speed you tell it to go. Start by setting a P value of a few hundred (P is the proportion correction to the error between the desired speed and actual speed) and see if that gets your motor spinning. Be careful, while tuning your PID constants the motor can sometimes move erratically. Leave I and D at zero for now. Make sure you set the number of encoder lines (ticks per revolution) in the configuration tab. The encoder/potentiometer radio buttons are grayed out in speed mode because speed mode only supports encoders at this time. Whether this works or not, also be sure you're running the latest firmware on the Jaguars and the latest BDC-COMM (all version 87). They can be found here: www.luminarymicro.com/jaguar If you are still having trouble, post some more info about your setup, and a full screen shot of the BDC-COMM screen. -David |
Re: Problem using encoders on Jaguar
Thanks for the tip. We updated the Jaguar, and it now works.
There are still a few problems, though. The motor jerks on-off at low speed (50 rpm or so and lower), and runs at much higher than the target speed in reverse. We set P=100, I=0, D=0, and set the encoder to 360 segments, as that's how many it has and it is on the output shaft of the KOP transmission. |
Re: Problem using encoders on Jaguar
Now that you've got it spinning, it is just a matter of tuning your constants.
I saw the same behavior when I was playing with a kit encoder, CIM, and a toughbox on our robot. I found that a much lower P with a little bit of I seemed to work well. I was using P = 0.3 and I = 0.001. It just takes time to find the perfect values for your system. Good luck with tuning! -David |
Re: Problem using encoders on Jaguar
Quote:
If it is on the cRIO, then which language are you using C++, Java, or Labview? The reason that I am asking is because, in a few days, I will be wiring up the robot. On the 1 jag that I used with the potentiometer, the position couldn't be read by the jag, but the position set-point could be sent. If the encoder can be read in by the cRIO, then I will use the speed control of the jaguar, otherwise I will wire the encoders to the digital sidecar as I need them for autonomous. |
Re: Problem using encoders on Jaguar
So far we are running the Jag only through BDC-COMM, but today we will try it on the cRio and see if we can read the encoder. If not, we may wire the encoder both to the Jag and the cRio, as we also will need it for autonomous.
We'll update our progress on this forum. |
Re: Problem using encoders on Jaguar
e tweaked the PID values and it now works perfectly.
Here's a screenshot of what we used on the Toughbox: ![]() We tried getting it to work on the cRio, and made some progress, but aren't there yet. More tomorrow. |
Re: Problem using encoders on Jaguar
Quote:
Luckily for me, I haven't fully wired the robot yet, so I still have time to wire it to the cRio if needed. Which programming language are you using? |
Re: Problem using encoders on Jaguar
Has anyone gotten the speed control to work without using the BDC utility, or Labview? I tried writing my own speed driver, but it doesn't work at all. I cannot use the utility because we don't have a black jaguar (yet, just ordered it).
If you have gotten the speed control, could you kindly post the code, or point me in the direction of a repository? The first forge hasn't been updated in a while, and only works for percent voltage. We are using C++. |
Re: Problem using encoders on Jaguar
Quote:
|
Re: Problem using encoders on Jaguar
I was looking at 'File releases'.
I setup an account (wow I hate those password restrictions) and I downloaded the current versions. I'm shocked at how close my code was to this. It gives me the (false) impression that I know what im doing haha. Can't wait to test this tomorrow, (well technically today :0) Thanks Joe. |
Re: Problem using encoders on Jaguar
Ok, So we have it working with BDC-Com perfectly. Sadly with the Crio it does not.
We set every thing up the same as we do on BDC-COM then confirm that by getting the values back from the jaguar. This leads me to believe there is a problem with the labview library. In fact we had it working one time, I have a video of it. On BDC-COM it ALWAYS works. I have been trying to compare the serial output from BDC-com and the Crio. I have even looked at the source code of the Jaguar, which does not seem to match the protocol BDC is sending, this is very frustrating. Any ideas? Here is it working on labview properly, some how... http://www.youtube.com/watch?v=v9y6Q13V2oE http://www.youtube.com/watch?v=RAgxE...eature=related And then it stopped working properly, now the speed is way to fast. And it takes a long time to reverse direction, I will post a video soon |
Re: Problem using encoders on Jaguar
Have you made any progress on this?
We succeeded last night in getting something sort-of working with a slightly modified version of the C++ CANJaguarPositionControlExample from FirstForge (you have to sign in and download from the FirstForge SVN server to get it). We modified the code to select the encoder, instead of the potentiometer, as the position sensor. We also changed the CAN channel to match one of the Jaguars on our robot. We were able to make the motor move, but we have not successfully adjusted the PID constants to stabilize the position control. We are using a Black Jaguar with the serial port from the cRIO. We are using standard CIM motors and the AndyMark gearbox with the standard encoders installed (we had to modify/shave the standard mounting plastic hardware to fit around the motor -- if you force it, the encoder will bind and you won't get any signals from the encoder). A few things that we learned: + it is essential to update the Jaguars to the latest version of the firmware (we are using version 87) from the www.Luminarymicro.com/jaguar site. This allowed us to use the BDC-COMM application to control the CAN network of Jaguars directly (we are using a http://www.iogear.com/product/GUC232A/ USB --> Serial port device to bridge between our laptop USB port and the serial port into the Black Jaguar). + The 3 PID constants all default to 0.0 -- nothing will happen with these at 0.0. + The cRIO has to have it's firmware updated and configured to include the black Jaguar code. Get the code here: (http://firstforge.wpi.edu/sf/frs/do/...gbridgeplugin). The update/config instructions are here: http://firstforge.wpi.edu/sf/projects/canjaguar + To effectively run this example, also run the "Position Control Tuning Dashboard" project from the "CANJaguar Dashboards" folder from the FirstForge SVN server. This allows you to modify the PID contstants & visualize the results. You have to configure this dashboard as your robot control station dashboard, either by installing it on the drive station or setting it up as a "Remote Dashboard" from the Driver Station Setup tab. We would very much like to get this working with LabVIEW, but as yet we keep getting -52007 errors when we try to use the equivalent LabVIEW version of the position control example (again from FirstForge). Anyone succeeding with LabVIEW? |
Re: Problem using encoders on Jaguar
I just deleted the can receive from the code...It is not needed.
What I am looking at doing is re-writing the library. Tough it seems to have everything it needs. I been looking at what BDC-COM sends the jaguars. Code:
I am filtering for packets with Additional dataCode:
MESSAGE IDthe second MS Byte is the Can Bus type, 0x02 means motor the next 6 bits are the actual message ID, the last 6 bits hold the device id device id is a number from 0(broadcast) to 63, you OR it with the message ID The packets are as fallows a header consists of two bytes First byte = 0xff Second is message size msgSize = size of msgID (always 4 bytes) + number of data bytes Code:
< HEADER > | <MSG ID> | <data> |0xFE is escaped by 0xFD for the data THere is no end of packet, end of packet is determined by second byte in the header (size of packet); If the amount of data read in is not the same as the data declared in the header the packet, it is thrown out. |
Re: Problem using encoders on Jaguar
After a few hours of slamming our faces into the keyboard with these same problems we finally figured them out. If you are having a long delay when switching from forward to reverse that means that your I value is too high in your PID. Lower this value and you should see some improvement.
BTW we are using the FirstForge code for Labview so if you have any questions feel free to ask. We have successfully gotten the speed control to work.:D We also fixed our -52007 error, but for the life of me I cannot remember what we did. Do all of your Jaguars have unique ID's? Is your console out on or off? Try switching it and see if that works. In speed control you will be sending a value of rps to the jaguar instead of the rpm's that the BD-COMM application looks like it sends. Our PID numbers are P = 10, I = 0.002, and D = 0. |
| All times are GMT -5. The time now is 02:44. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi