|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#31
|
||||
|
||||
|
Re: New to 2CAN and Jaguar
So does it mean I can only call SetPID after I call ChangeControlMode to a close-loop mode? And I assume I have to call SetPID every time after I change to a close-loop mode. In other words, the PID constants will be cleared on every mode change?
Hmm, thinking about it some more, it makes sense. Since the PID constants are different for different close-loop mode, it makes sense to set them after a close-loop mode is set. Thanks for the info. Learn something today :-) Last edited by mikets : 17-01-2012 at 19:26. |
|
#32
|
|||
|
|||
|
Re: New to 2CAN and Jaguar
Quote:
I don't believe they are cleared... they are stored as separate variables in the Jaguar. That could be easily tested by setting one mode, calling SetPID, changing modes, calling SetPID again, then switching modes back and calling GetPID. |
|
#33
|
||||
|
||||
|
Re: New to 2CAN and Jaguar
Yes, I remember now. I saw that behavior in bdc-comm tool.
|
|
#34
|
||||
|
||||
|
Re: New to 2CAN and Jaguar
I have another issue. I am also experimenting with kSpeed mode. No code this time. I am playing with the bdc-comm tool.
- I set one of the Jags to kSpeed mode - Set the speed to 30 rpm. - I kept Ki and Kd zero and was playing with Kp only. - The wheel moved very jerkily (i.e. jerk forward, stop, jerk forward stop, ...) so it is making a loud clunging noise. - I tried Kp = 1.0 and up. The larger Kp, the louder is the clunging noise. My theory was that the Kp was too strong. It started too strong and because of the "brake" mode, it also stopped too suddenly. Basically, the "speed" was oscillating. So I cranked down Kp. Eventually, when Kp is 0.35, the wheel seems to turn smoothly. But when looking at the speed, it was very far from the target. For example if I set target to 70 rpm, it comes back with 30. When I set it to 60 rpm, it came back at 25. Am I interpreting this correctly? I am not sure about the units because the bdc-comm tool does not show me the units in Speed mode. It looks like the target value box can only accept a maximum value of 100 (may be it's a percentage? But percentage of what?). |
|
#35
|
|||
|
|||
|
Re: New to 2CAN and Jaguar
Quote:
Is this still true with v101 of the firmware? I think this version of the firmware will bring the Jaguar back online after such a fault? Or is this a different set of circumstances? Quote:
This is the code I was playing with last night to get familiar with the Jaguar closed loop current control. Basically a tank drive that commands current: Code:
#include "testBot.h"
#include "CANJaguar.h"
#include "Joystick.h"
testBot::testBot()
{
}
testBot::~testBot()
{
}
void testBot::OperatorControl()
{
printf("Entering Operator Control\n");
GetWatchdog().SetEnabled(true);
CANJaguar* pJag2 = new CANJaguar(2,CANJaguar::kCurrent);
CANJaguar* pJag3 = new CANJaguar(3,CANJaguar::kCurrent);
CANJaguar* pJag4 = new CANJaguar(4,CANJaguar::kCurrent);
CANJaguar* pJag5 = new CANJaguar(5,CANJaguar::kCurrent);
Joystick* pDriveStick1 = new Joystick(1);
Joystick* pDriveStick2 = new Joystick(2);
pJag2->SetPID(0.01,0.05,0);
pJag3->SetPID(0.01,0.05,0);
pJag4->SetPID(0.01,0.05,0);
pJag5->SetPID(0.01,0.05,0);
pJag2->ConfigNeutralMode(CANJaguar::kNeutralMode_Coast);
pJag3->ConfigNeutralMode(CANJaguar::kNeutralMode_Coast);
pJag4->ConfigNeutralMode(CANJaguar::kNeutralMode_Coast);
pJag5->ConfigNeutralMode(CANJaguar::kNeutralMode_Coast);
pJag2->EnableControl();
pJag3->EnableControl();
pJag4->EnableControl();
pJag5->EnableControl();
pJag2->Set(0, 0);
pJag3->Set(0, 0);
pJag4->Set(0, 0);
pJag5->Set(0, 0);
while(IsOperatorControl() && IsEnabled())
{
GetWatchdog().Feed();
pJag2->Set(pDriveStick1->GetY() * 50);
pJag4->Set(pDriveStick1->GetY() * 50);
pJag5->Set(pDriveStick2->GetY() * -1 * 50);
pJag3->Set(pDriveStick2->GetY() * -1 * 50);
}
printf("Leaving Operator Control\n");
}
void testBot::Autonomous()
{
GetWatchdog().SetEnabled(false);
while(IsAutonomous() && IsEnabled())
{
}
}
START_ROBOT_CLASS(testBot);
|
|
#36
|
||||
|
||||
|
Re: New to 2CAN and Jaguar
Quote:
|
|
#37
|
|||
|
|||
|
Re: New to 2CAN and Jaguar
Quote:
http://www.chiefdelphi.com/forums/sh...d.php?t=100135 http://www.chiefdelphi.com/forums/sh...ad.php?t=90508 |
|
#38
|
||||
|
||||
|
Re: New to 2CAN and Jaguar
We have the same issue on jerkyness at low speed. Still trying to figure that one out... see other threads on CANbus Control. We wrote our own PID code, but may move to the Jag intrenal PID to offload cRio.
But on the Kp we had the same result as others. Kp alone will always yields a top speed of approx 1/2 setpoint. Ki however, does a beatiful job at reaching setpoint and (in our configuration) became the dominant control force. |
|
#39
|
||||
|
||||
|
Re: New to 2CAN and Jaguar
In order to get a stable speed control using PID, you need to integrate the PID controller. That's why we can't use the Jaguar's built-in PID. There shouldn't be any problem with the cRIO. It would just be an extra PID calculation in the main robot loop.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|