Go to Post Disclaimer: I am not an electrical engineer nor an electrician. I occasionally play one on CD. And when inspecting robots, sort of... - jvriezen [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 30-01-2015, 21:21
robotdna robotdna is offline
Registered User
FRC #4593
 
Join Date: Jan 2015
Location: SD
Posts: 7
robotdna is an unknown quantity at this point
Talon SRX "speed_control" mode? (Python)

Hello all,

Our team is programming our wheeled chunk of metal this year using Python (but, this issue doesn't seem to pertain to the Python subforum too much). While delving into other mecanum encoder threads, I saw a mention of a built-in SRX function that allows us to automatically send our desired wheel speeds directly to the controller, reducing our pain in figuring out how to really get our digital encoders to function with a mecanum drive.

So, is there a magical function that allows us to define a desired velocity (granted, I know it depends on wheelbase, radius, etc) so drifting is not as large of an issue?

Additional detail: All encoders are plugged into the SRX's which are all in a CAN daisy chain.


Thanks,
robotdna
  #2   Spotlight this post!  
Unread 30-01-2015, 22:14
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: 531
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 "speed_control" mode? (Python)

Checkout the Talon SRX software reference manual to learn more about the Talon SRX's features. (google : talon srx software reference manual).
The ref manual has LV, C++, and Java examples for everything.

Then checkout the python documentation to see how frc py was ported to support it.
http://robotpy.readthedocs.org/en/la...?highlight=srx
  #3   Spotlight this post!  
Unread 30-01-2015, 22:15
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,086
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: Talon SRX "speed_control" mode? (Python)

I'm sure you've seen the API docs already: http://robotpy.readthedocs.org/en/la.../CANTalon.html

My understanding is that you have to switch the talon into the correct control mode, set the correct PID parameters, and then you just can just call "set" with the desired control parameter (in this case, velocity).

I feel like I saw somewhere in the forums mention about a firmware update for the talons, so make sure those are up to date also.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
  #4   Spotlight this post!  
Unread 04-02-2015, 18:25
robotdna robotdna is offline
Registered User
FRC #4593
 
Join Date: Jan 2015
Location: SD
Posts: 7
robotdna is an unknown quantity at this point
Re: Talon SRX "speed_control" mode? (Python)

Hi,

Yes, contrary to this community's belief, I actually read the manual AND documentation AND user's guide before I posted this haha.

How do we set the Talon's speed control mode? I know there is the classControlMode class, which I imported (but only with the "Speed = hal.TalonSRXConst.kMode_VelocityCloseLoop" portion under it, as we only need the Speed Control Mode). I also placed the "def changeControlMode(self, controlMode)" under the our example MyRobot function. I was a little unsure as to what to change in that code so I tried ControlMode.Speed (?) under some of the spots that contained ControlMode. It didn't break, but I have no idea if it worked.

Once those were placed, I tried defining the set function and doing some stuff with that. A lot of that failed.


It's clear that the functionality exists for what we want to do (I think), I just don't know really how to use it all. (By now you should have figured out I'm kind of an awful programmer).

Would it be easier to post our code here and see if any of you can help us?


I'm sorry for all the trouble, and many thanks,
robotdna
  #5   Spotlight this post!  
Unread 04-02-2015, 18:29
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: 531
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 "speed_control" mode? (Python)

What's happening (symptoms) vs what are your expectations (what you expect to see).

I mean does the motor move?
Talon SRX LEDs?
Does the Talon show up in the web-based config?
What mode is reported in the Self-Test after you enable?
Is the sensor pos changing in the Self-Test?
Is the sensor pos moving int a positive direction when positive throttle is applied?
  #6   Spotlight this post!  
Unread 04-02-2015, 19:00
robotdna robotdna is offline
Registered User
FRC #4593
 
Join Date: Jan 2015
Location: SD
Posts: 7
robotdna is an unknown quantity at this point
Re: Talon SRX "speed_control" mode? (Python)

Quote:
Originally Posted by ozrien View Post
What's happening (symptoms) vs what are your expectations (what you expect to see).

I mean does the motor move?
Talon SRX LEDs?
Does the Talon show up in the web-based config?
What mode is reported in the Self-Test after you enable?
Is the sensor pos changing in the Self-Test?
Is the sensor pos moving int a positive direction when positive throttle is applied?
Hi,

We want our robot to drive straight when we push our stick forward. It's pretty straight already, but not perfect. The ultimate goal is to have the encoder stuff available for use in the autonomous mode.


Does the motor move? Yes, it does. Quite well.

Talon SRX LEDs? They flash different colors depending on the direction. And the brake/coast light functions too.

What mode is reported in the Self-Test after you enable? I assume you are referencing the "Test" tab in the driver's station. When enabled, nothing really comes up. It really looks the same, I think. Maybe I am misunderstanding you...

For those last two questions, I don't even know where to locate those values. So, I probably misunderstood your last question as well.


Thank you for all your help so far,
robotdna
  #7   Spotlight this post!  
Unread 04-02-2015, 19:09
Ben Wolsieffer Ben Wolsieffer is offline
Dartmouth 2020
AKA: lopsided98
FRC #2084 (Robots by the C)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Manchester, MA (Hanover, NH)
Posts: 520
Ben Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud of
Re: Talon SRX "speed_control" mode? (Python)

Quote:
Originally Posted by robotdna View Post
What mode is reported in the Self-Test after you enable? I assume you are referencing the "Test" tab in the driver's station. When enabled, nothing really comes up. It really looks the same, I think. Maybe I am misunderstanding you...
He is referring to the the self-test function of the Talons in the roboRIO web dashboard.
__________________



2016 North Shore District - Semifinalists and Excellence in Engineering Award
2015 Northeastern University District - Semifinalists and Creativity Award
2014 Granite State District - Semifinalists and Innovation in Control Award
2012 Boston Regional - Finalists
  #8   Spotlight this post!  
Unread 04-02-2015, 19:14
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: 531
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 "speed_control" mode? (Python)

So if you're trying to enable closed-loop (speed for example) and it's not working to your expectations, use the Self-Test in Section 2.4 of the Talon SRX Software Reference Manual to check the signals that reflect what the closed-loop is doing, what the sensor position is, which mode the talon is in, what the applied throttle is, etc... This is also mentioned in Section 11.2

The Web-based config also will confirm your gain values which could explain why the closed-loop wasn't meeting your expectations. Or it might not, it's too hard to guess what this means...
Quote:
"Once those were placed, I tried defining the set function and doing some stuff with that. A lot of that failed. "
What was the motor doing when you were in the speed control mode? Describing what it was doing might help us explain what's going on.

Before you start closed-looping, please select the correct sensor following the steps in section 7. I know you're using Py, but the functions are very similar. Please follow the instructions in Section 7.4 to sign your sensor in a fashion where positive motor drive causes the sensor to move in a positive direction.
Closed Thread


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 21:05.

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