Go to Post If they need a place where they can get a chance to learn interpersonal skills (like a team), it might just help them to become well-adjusted adults, as opposed to pathologically antisocial engineers (who got good grades). - Tristan Lall [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 04-02-2012, 00:44
Method's Avatar
Method Method is offline
Registered User
no team
 
Join Date: Jan 2012
Rookie Year: 2011
Location: Ca
Posts: 38
Method is an unknown quantity at this point
Post 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())

//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.
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 17:38.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi