|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
hello! I am using can jags and a custom drive-- not too complex atm but i have some bugs.
The code builds and runs on the robot but the indicator lights on the jags show no changes as the controllers are used. //def so remotes work #define IO (DriverStation::GetInstance()->GetEnhancedIO()) //declarations CANJaguar lefty, righty, leftyB, rightyB, intake, arm, LTop, LBot; Joystick pilot, copilot; //constructs DoctaEight(void): pilot(1), copilot(2), lefty(2), righty(3), leftyB(4), rightyB(5), { GetWatchdog().Kill(); lefty.ChangeControlMode(CANJaguar::kPercentVbus); righty.ChangeControlMode(CANJaguar::kPercentVbus); leftyB.ChangeControlMode(CANJaguar::kPercentVbus); rightyB.ChangeControlMode(CANJaguar::kPercentVbus) ; intake.ChangeControlMode(CANJaguar::kPercentVbus); LTop.ChangeControlMode(CANJaguar::kPercentVbus); LBot.ChangeControlMode(CANJaguar::kPercentVbus); } //drive //negate is just a positive or negative char to turn the drive void DoctaEight::drive(void) { GetWatchdog().Kill(); if (pilot.GetY() > 0 && pilot.GetX() >= 0)//forward right { lefty.Set(pilot.GetY() * negate);//left motors full leftyB.Set(pilot.GetY() * negate);//left motors full righty.Set(( pilot.GetY() - pilot.GetX() * 2 ) * negate);//right motors full dec by twiceX abs X rightyB.Set(( pilot.GetY() - pilot.GetX() * 2 ) * negate); }//(so up to x = 0 right rev and when y negative, backward curve) else if (pilot.GetY() < 0 && pilot.GetX() > 0)//backward left { righty.Set(pilot.GetY() * negate * -1); rightyB.Set(pilot.GetY() * negate * -1); lefty.Set((pilot.GetY() - pilot.GetX() * 2) * negate); leftyB.Set((pilot.GetY() - pilot.GetX() * 2) * negate); } else if (pilot.GetY() > 0 && pilot.GetX() <= 0)//forward left { righty.Set(pilot.GetY() * negate); rightyB.Set(pilot.GetY() * negate); lefty.Set((pilot.GetX() * 2 + pilot.GetY()) * negate); leftyB.Set((pilot.GetX() * 2 + pilot.GetY()) * negate); } else if (pilot.GetY() < 0 && pilot.GetX() < 0)//back right { lefty.Set(pilot.GetY() * negate * -1);//left full back leftyB.Set(pilot.GetY() * negate * -1);//left full back righty.Set(( pilot.GetY() + pilot.GetX() * 2 ) * negate);//right morots full dec by twice abs X rightyB.Set(( pilot.GetY() + pilot.GetX() * 2 ) * negate); } else { righty.Set(pilot.GetY() *negate); rightyB.Set(pilot.GetY() *negate); lefty.Set(pilot.GetY() *negate); leftyB.Set(pilot.GetY() *negate); } } We used 4prom modular cable- telephone wire- to connect the can jags to the Crio. The values set in the jags during firmware update are 2, 3, 4 and 5. Controllers are in USB ports on DS. When the Crio was imaged we selected 'black jaguar can jags crio connection' (that is not verbatim as i do not remember such) Please assist. Last edited by Method : 04-02-2012 at 02:22. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|