![]() |
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 |
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 |
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. |
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 |
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? |
Re: Talon SRX "speed_control" mode? (Python)
Quote:
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 |
Re: Talon SRX "speed_control" mode? (Python)
Quote:
|
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:
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. |
| All times are GMT -5. The time now is 01:41. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi