Go to Post Every single person on the team, read the manual, cover to cover, NO skimming. Do not give the task of knowing the rules to a few people. Do not pass go, do not collect $200, READ THE MANUAL. - RoboChair [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

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 04-03-2013, 08:20 PM
Dragonslayerend Dragonslayerend is offline
DuncanDynamics lead programmer
AKA: Tom Xiong
FRC #3970 (DuncanDynamics)
Team Role: Programmer
 
Join Date: Oct 2012
Rookie Year: 2012
Location: Fresno, CA, Duncanpoly Tech
Posts: 33
Dragonslayerend will become famous soon enoughDragonslayerend will become famous soon enough
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.
Reply With Quote
  #2   Spotlight this post!  
Unread 04-04-2013, 12:38 AM
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,569
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
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.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
Reply With Quote
  #3   Spotlight this post!  
Unread 04-04-2013, 03:04 AM
Dragonslayerend Dragonslayerend is offline
DuncanDynamics lead programmer
AKA: Tom Xiong
FRC #3970 (DuncanDynamics)
Team Role: Programmer
 
Join Date: Oct 2012
Rookie Year: 2012
Location: Fresno, CA, Duncanpoly Tech
Posts: 33
Dragonslayerend will become famous soon enoughDragonslayerend will become famous soon enough
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.
Reply With Quote
  #4   Spotlight this post!  
Unread 04-04-2013, 09:07 AM
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,569
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
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?
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
Reply With Quote
  #5   Spotlight this post!  
Unread 04-04-2013, 12:25 PM
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,569
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
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.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
Reply With Quote
  #6   Spotlight this post!  
Unread 04-04-2013, 01:29 PM
Dragonslayerend Dragonslayerend is offline
DuncanDynamics lead programmer
AKA: Tom Xiong
FRC #3970 (DuncanDynamics)
Team Role: Programmer
 
Join Date: Oct 2012
Rookie Year: 2012
Location: Fresno, CA, Duncanpoly Tech
Posts: 33
Dragonslayerend will become famous soon enoughDragonslayerend will become famous soon enough
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.
Reply With Quote
  #7   Spotlight this post!  
Unread 04-06-2013, 10:12 PM
Dragonslayerend Dragonslayerend is offline
DuncanDynamics lead programmer
AKA: Tom Xiong
FRC #3970 (DuncanDynamics)
Team Role: Programmer
 
Join Date: Oct 2012
Rookie Year: 2012
Location: Fresno, CA, Duncanpoly Tech
Posts: 33
Dragonslayerend will become famous soon enoughDragonslayerend will become famous soon enough
Re: How to reset encoders used with CAN

Oh hey thanks and It works!
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 09:53 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