Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   How to reset encoders used with CAN (http://www.chiefdelphi.com/forums/showthread.php?t=115756)

Dragonslayerend 03-04-2013 20:20

How to reset encoders used with CAN
 
Hello, is there a function that can be used from the C++ wpilib to reset encoders that are connected to Jaguars. I'm doing a position drive with CAN and unless I reboot the cRIO the position values never reset.

Kevin Sevcik 04-04-2013 00:38

Re: How to reset encoders used with CAN
 
If you're using the Jaguar in kPosition mode, the EnableControl method has an encoderInitialPosition parameter that will set and initial position for the encoder.

Otherwise, I'm going to need to dig into the Jaguar code tomorrow to see when and how the encoder position gets reset and all that.

Dragonslayerend 04-04-2013 03:04

Re: How to reset encoders used with CAN
 
Thanks though I actually wanted to know how to reset the actual encoder and it just still dosen't seem to be a way.

Kevin Sevcik 04-04-2013 09:07

Re: How to reset encoders used with CAN
 
Okay, so I'm looking to see if there's a way you can reset the Jaguar's encoder counts so that getPosition() will read 0.0 or some number you send it instead of reading whatever number the encoder has counted up to while it's running. That what I'm calling "resetting the encoder". Are you trying to do something different or something?

Kevin Sevcik 04-04-2013 12:25

Re: How to reset encoders used with CAN
 
Just checked the TI Jaguar firmware source code. The encoder position is set to 0.0 when the Jaguar powers on, and it can be set to an arbitrary number when you enable position control mode by calling ChangeControlMode(kPosition) then calling EnableControl(double initialPosition). It's the call to EnableControl while you're in kPosition mode that resets the encoder position. I believe you can call EnableControl again while in kPosition mode to reset the encoder without disabling the position control.

Dragonslayerend 04-04-2013 13:29

Re: How to reset encoders used with CAN
 
Oh thankyou for stating that, I forgot about that part. I'll try it and yeah I'm just trying to reset the encoder. It's to build a library that will contain commands that will make the robot do certain movements. Then with the library I can stack together blocks of movements to make a whole auton driving code.

Dragonslayerend 06-04-2013 22:12

Re: How to reset encoders used with CAN
 
Oh hey thanks and It works!


All times are GMT -5. The time now is 12:52.

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