can drive

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())

CANJaguar lefty, righty, leftyB, rightyB, intake, arm, LTop, LBot;
Joystick pilot, copilot;


//negate is just a positive or negative char to turn the drive
void DoctaEight::drive(void)
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);
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.

So you have the db9 to rj-45 adapter wired up correctly with a terminating resistor and a 6 wire cable to the first black jaguar? And you have terminator on the other side as well?

I suspect the problem is in the “telephone wires” which are backwards from the wires the Jaguars use. If you hold a wire flat, the connectors should face different directions.

Also, do you have your initialization right? It appears that you have an extra comma at the end and the compiler doesn’t like that.

That sounds right but I am the programmer; not electronics. Ill respond to this shortly

Thankyou- I’ll look into it.

Yes- sorry: my full code is far larger and I neglected to remove the comma

CAN cables are not wired in opposite directions. Also, we have a terminal and the 6 wire is connected from the crio to the first black Jag.