Go to Post Based on my experience coaching basketball and robotics, there is no doubt in my mind that if a sports coach receives $x then a robotics coach should, too. - dtengineering [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
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 14-12-2015, 17:57
entertainr entertainr is offline
Build Addicted
AKA: Levi
FRC #4522 (Team SCREAM)
Team Role: Programmer
 
Join Date: Apr 2014
Rookie Year: 2013
Location: Sedalia
Posts: 7
entertainr is an unknown quantity at this point
Talon SRX Swerve Control

We have been using Talon SRXs to control our swerve drive that's in development. For clarity "turn" will refer to the angle of the wheel, and "spin" will refer to the velocity. While attempting to turn the wheel past the 1023 limit, instead of continuing past 1023, the Talon will return to a point in the 0-1023 interval. I am currently using an Analog Encoder with the Talon in the Position closed-loop mode.

To attempt to solve this problem, I converted the encoder signal into an equivalent degree value, processed it to get my new setpoint, and then converted it back to a 0-1023 value in the same interval that the encoder is in. I believe my problem lies in the red boxed area of my code, but I could very easily be wrong. Any help is appreciated, and I will provide any additional information if needed.
Attached Thumbnails
Click image for larger version

Name:	Swerve Wheel.jpg
Views:	76
Size:	128.7 KB
ID:	19556  
Reply With Quote
  #2   Spotlight this post!  
Unread 14-12-2015, 18:53
ozrien's Avatar
ozrien ozrien is offline
Omar Zrien
AKA: Omar
no team
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2003
Location: Sterling Heights, MI
Posts: 522
ozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond repute
Re: Talon SRX Swerve Control

When "Analog Encoder" is selected the wraparound is tracked (1023 => 1024). It sounds like "Analog Potentiometer " is instead selected (so 1023 => back to 0).

Can you grab a self-test screenshot as you manually rotate (or just straight drive) the swerve module using the RIO web based config? That will tell us what the reported sensor position is before and after the wraparound and confirm the selected feedback device.

Is talon firmware 1.4? (http://www.ctr-electronics.com/talon...ical_resources)
Reply With Quote
  #3   Spotlight this post!  
Unread 15-12-2015, 11:59
entertainr entertainr is offline
Build Addicted
AKA: Levi
FRC #4522 (Team SCREAM)
Team Role: Programmer
 
Join Date: Apr 2014
Rookie Year: 2013
Location: Sedalia
Posts: 7
entertainr is an unknown quantity at this point
Re: Talon SRX Swerve Control

The Talon has the 1.4 firmware. Here are screenshots on either side of 1023.
Attached Thumbnails
Click image for larger version

Name:	Before Self-Test.PNG
Views:	30
Size:	17.0 KB
ID:	19564  Click image for larger version

Name:	After Self-Test.PNG
Views:	24
Size:	16.9 KB
ID:	19565  
Reply With Quote
  #4   Spotlight this post!  
Unread 15-12-2015, 13:28
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Talon SRX Swerve Control

The POS value did as expected and went past 1023. Your code appears to be throwing away the overflow and trying to limit everything to a single rotation.

Don't do that. Just add to or subtract from the current setpoint, without worrying about going "too far" in any direction.

Last edited by Alan Anderson : 15-12-2015 at 13:33.
Reply With Quote
  #5   Spotlight this post!  
Unread 15-12-2015, 14:43
ozrien's Avatar
ozrien ozrien is offline
Omar Zrien
AKA: Omar
no team
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2003
Location: Sterling Heights, MI
Posts: 522
ozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond reputeozrien has a reputation beyond repute
Re: Talon SRX Swerve Control

Cool so the Talon SRX, and sensor are working as expected.

So if you want to do servo to the closest degree, what I'd recommend is taking a look at the google sheet below. Basically the strategy is to input the current sensor position (could be anything) and the target-desired angle (expressed in sensor units from 0 to 1023). The output is the final full position to send to the Talon to servo to. The middle columns will calc the distance to the target in both directions, and then chooses the smaller distance. Looks like this is what's attempted in your VI, but it's hard to follow because there is a lot going on.

hah, Levi you emailed me the same question so I guess this post is redundant, but figured posting this on CD helps everybody.

Zebracorn's (FRC900) followed this strategy last year and it seemed to work well. For anyone interested in looking at an LV implementation I would check out their github (2015 FRC code base).

Google sheet. Make a copy into your google drive or download as excel so you can edit.
https://docs.google.com/spreadsheets...it?usp=sharing

Last edited by ozrien : 15-12-2015 at 14:46.
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 10:29.

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