|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: CAN, PID, Mecanums
Quote:
Quote:
Quote:
Quote:
|
|
#2
|
||||
|
||||
|
Re: CAN, PID, Mecanums
i don't understand why you have to use speed instead of the regular
|
|
#3
|
|||
|
|||
|
Re: CAN, PID, Mecanums
The robot is currently not moving at all when the joysticks are moved.
I know it is either a problem with the encoders or with my code, but I can't be sure which. The robot previously moved when being controlled by different code using percent vbus, so I know the other wiring is correct. Here's what i'm currently doing in my code: in begin vi: i open a can reference to each motor, specifying speed mode, device number, and whether or not it is inverted. then I "set speed ref" using "quad encoder" as the speed reference (correct for KOP encoders?). I "set PID" constants, and then I enable the motors. I currently have my PID constants set as P: 0.1 I: 0.004 D: 0. Are these reasonable for mecanums directly driven by toughboxes? If not, could someone give me an explanation oof the process of manual tuning so I can be sure I did it correctly? The motors are then wired into a 4 motor drive of "existing motors" and the "max output" is set. (this should be the top speed in rpm, right?) in teleop vi: x and y axis are wired to x and y of a holonomic drive, and x axis of another joystick is wired to rotation The robot does not move at all and the colors on the jaguars do not change, even when the joysticks are pushed fully in any direction. I believe the problem is in one of 3 places: wiring of the encoders, logic of my code, or values of my pid constants. |
|
#4
|
||||
|
||||
|
Re: CAN, PID, Mecanums
Well, we know that the wiring of your encoders is not the issue right now. If that were the case, the Jaguars would go full-speed FWD when you pushed forward, and full-speed REV when you went reverse.
My first guess would be that you haven't set the "max RPM" in the OpenExistingMotors VI, and that you haven't set the number of lines on the encoder. If you're on tough boxes with CIMs, the max RPM should be about 4500 / 12.6, which is around 350 RPM. The default is 1. |
|
#5
|
|||
|
|||
|
Re: CAN, PID, Mecanums
It was in fact a failure to set the encoder lines in the open vi.
Now I have another mostly unrelated problem. The joysticks we are using no longer spring back perfectly to center, so the robot moves slightly even when the joysticks are not being touched. I looked up the jaguar calibration and found that it appeared to only apply to pwm. Is there a similar process for CAN or a way i can correct for it in the code? |
|
#6
|
||||
|
||||
|
Re: CAN, PID, Mecanums
Calibrating the jaguars isn't what you want to do anyway. What you need to do is implement a dead band on your joystick inputs. Basically you take any values less than some value, say 0.02 or something, and set it to 0.00. That way even if the joystick doesn't center itself completely, your robot won't be moving.
|
|
#7
|
|||
|
|||
|
Re: CAN, PID, Mecanums
I tried implementing a dead band, and it didn't work as expected. The robot will not move at all with the dead band in place. I made a VI to handle the dead band so the teleop is cleaner and it can be reusable...
I have attached screen shots and the VI itself. If someone could help me debug it that would be great. thanks |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|