Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Get Control Mode from Talon SRX (http://www.chiefdelphi.com/forums/showthread.php?t=154307)

robot_rover 26-01-2017 20:36

Get Control Mode from Talon SRX
 
I have been looking through the methods and the documentation and for the life of me I cannot find where you can get the current control mode of a talon SRX. Does anyone know how to obtain this?

AustinShalit 26-01-2017 20:41

Re: Get Control Mode from Talon SRX
 
Quote:

Originally Posted by robot_rover (Post 1636884)
I have been looking through the methods and the documentation and for the life of me I cannot find where you can get the current control mode of a talon SRX. Does anyone know how to obtain this?

Code:

CANTalon.getControlMode();
http://www.ctr-electronics.com/downl...tControlMode--

robot_rover 28-01-2017 10:19

Re: Get Control Mode from Talon SRX
 
Is there a labview equivalent of this?

Jacob C. 28-01-2017 10:55

Re: Get Control Mode from Talon SRX
 
There isn't actually a LabVIEW equivalent right now.

The control mode is part of the signals that get sent to the Talon SRX over CAN - the java/c++ calls are just returning the member variable of the software object, not a value returned from the Talon itself.

Right now the Get Status VI for Talon SRX only returns the cluster of signals that are being received from the CAN bus, not those being sent.

It's something that we might be able to add if it makes sense. What application are you trying to get the control mode for?

robot_rover 28-01-2017 16:41

Re: Get Control Mode from Talon SRX
 
Currently I was trying to get the control mode to see if it needed to be changed in teleop. When our bot is in auto it sets the mode to position. What I was trying to do was set the mode to speed in the teleop vi only if it wasn't already in Speed mode. Right now I have a workaround where it only runs the change mode code if the bot has been disabled since the last time the teleop vi was called.

Mark McLeod 28-01-2017 16:43

Re: Get Control Mode from Talon SRX
 
You could just maintain a record of the last mode set in a Global variable.
Then check it when you go to set a mode to see if it's different.

thatnameistaken 28-01-2017 16:48

Re: Get Control Mode from Talon SRX
 
Quote:

Originally Posted by robot_rover (Post 1637519)
Currently I was trying to get the control mode to see if it needed to be changed in teleop. When our bot is in auto it sets the mode to position. What I was trying to do was set the mode to speed in the teleop vi only if it wasn't already in Speed mode. Right now I have a workaround where it only runs the change mode code if the bot has been disabled since the last time the teleop vi was called.

If you always want speed mode in teleop, you could just set it to speed regardless of mode. There's no issue with redundant mode change calls.

Edit: what Mark said above would also work for the way you're trying to go about it.

Edit again: Additionally, if you're only changing out of speed mode in auto, another solution would be to set the talons to speed mode at the very end of the routine.

robot_rover 28-01-2017 16:50

Re: Get Control Mode from Talon SRX
 
I suppose since it's a value the robotic sends it will not matter how often it is change. That's nice and easy. Thanks all o/


All times are GMT -5. The time now is 07:09.

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