Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   CANJaguar and Encoders (http://www.chiefdelphi.com/forums/showthread.php?t=102909)

nighterfighter 15-02-2012 16:22

CANJaguar and Encoders
 
How do I set a Jaguar, using CAN, to read the encoders and to rotate to a certain position?

I'm assuming I can set the ControlMode to PositionControl, but after that I am not sure what to do.

jwakeman 15-02-2012 17:08

Re: CANJaguar and Encoders
 
set the control mode:
Code:

void ChangeControlMode(ControlMode controlMode);
set the gains:
Code:

void SetPID(double p, double i, double d);

set the position feedback device to encoder:
Code:

void SetPositionReference(PositionReference reference);
enable control:
Code:

void EnableControl(double encoderInitialPosition = 0.0);
set a reference:
Code:

virtual void Set(float value, UINT8 syncGroup=0);

Kevin Sevcik 15-02-2012 17:09

Re: CANJaguar and Encoders
 
You also need to SetPositionReference, SetPID, and ConfigEncoderCodesPerRev.

Once you do all that, you EnableControl, and then Set the position you want.

The trickiest part is setting the PID values to useful numbers. You'll need to experiment here, and you'll want to start with small number and work your way up. Sadly, you HAVE to do this with your system completely together. You can't tune a PID unloaded and then add a load and expect it to work well or at all.


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

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