OCCRA
Go to Post I want to understand the physics. - Molten [more]
Home
Go Back   Chief Delphi > Technical > Electrical > CAN
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 02-15-2015, 08:55 PM
usbcd36's Avatar
usbcd36 usbcd36 is offline
Registered User
AKA: Chris Dickey
FRC #2399 (The Fighting Unicorns)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Solon, OH
Posts: 154
usbcd36 is a jewel in the roughusbcd36 is a jewel in the roughusbcd36 is a jewel in the rough
Resetting Jaguar Encoder Count

We are trying to reset the internal encoder count of a Jaguar to 0. This is supposedly possible to do using the enableControl(double encoderInitialPosition) function.

The Jag is generally being run in %Vbus mode. From what we understand, it's necessary to change the control mode to Position in order for the passed double to have any effect. This is supported by looking at the source code, which only packs and sends the encoderInitialPosition if the m_controlMode instance variable is set to Position. (CANJaguar.class)

We found an example of this being done in C++

Code:
CANJaguar::ControlMode oldMode = GetControlMode();
//printf("Reseting encoder on Jag [%d], mode %d\n", m_deviceNumber, oldMode);

SetPositionReference(CANJaguar::kPosRef_QuadEncoder);
ConfigEncoderCodesPerRev(pulsesPerFt);
	
ChangeControlMode(CANJaguar::kPosition);
EnableControl(0.0);
ChangeControlMode(oldMode);
EnableControl();
and wrote what would seem to be equivalent code in Java:

Code:
jaguar.setPositionMode(CANJaguar.kQuadEncoder, encoderCounts, 0, 0, 0);
jaguar.enableControl(0.0);
jaguar.setPercentMode(CANJaguar.kQuadEncoder, encoderCounts);
jaguar.enableControl();
but the next time the set method is called:

Code:
jaguar.set(0);
it throws a CANMessageNotAllowedException with the output: "messageID = 5", which is not documented anywhere.


Thoughts?
Reply With Quote
Reply


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 12:21 AM.

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