Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Talon SRX and Analog Encoders (http://www.chiefdelphi.com/forums/showthread.php?t=137261)

TBots 16-05-2015 17:17

Talon SRX and Analog Encoders
 
We just got some Talon SRX motor controllers and are working on understanding all of their potential. Mainly, we need to figure out how to hook up and use a magnetic absolute encoder (MA3) to each of our SRX. The SRX will be what controls the turning of our wheels in a swerve drive.

I've hear that the SRX have 'built-in' PID controllers. Is this true? And if so, do I still need to include PID in our labVIEW programming?

There are several examples of using the talon SRX in the software manual that was included with the SRX, but we are unable to distinguish which of them we are meant to use.

Thank you for the help! :)

Ether 16-05-2015 18:05

Re: Talon SRX and Analog Encoders
 


Quote:

I've hear that the SRX have 'built-in' PID controllers. Is this true?
Yes.


Quote:

And if so, do I still need to include PID in our labVIEW programming?
No. But you do need to do the following:

- connect the feedback sensor directly to the Talon (not the roboRIO)

- use CAN bus (not PWM) to control the Talon

- use the appropriate CAN commands to tell Talon what closed-loop mode you want (e.g. position or speed etc)

- use the appropriate CAN commands to set the gains in the Talon's PID controller.

- use the appropriate CAN commands to communicate the desired setpoint to the Talon's PID so it knows what value you want it to control to.




MaGiC_PiKaChU 16-05-2015 19:42

Re: Talon SRX and Analog Encoders
 
Quote:

Originally Posted by Ether (Post 1482545)




Yes.




No. But you do need to do the following:

- connect the feedback sensor directly to the Talon (not the roboRIO)

- use CAN bus (not PWM) to control the Talon

- use the appropriate CAN commands to tell Talon what closed-loop mode you want (e.g. position or speed etc)

- use the appropriate CAN commands to set the gains in the Talon's PID controller.

- use the appropriate CAN commands to communicate the desired setpoint to the Talon's PID so it knows what value you want it to control to.




also you'll need one of those for each talon
http://www.vexrobotics.com/217-4401.html

We had 14 SRX this year, 12 of them with a sensor in the breakout... This is amazing

TBots 16-05-2015 22:24

Re: Talon SRX and Analog Encoders
 
Quote:

Originally Posted by MaGiC_PiKaChU (Post 1482558)
also you'll need one of those for each talon
http://www.vexrobotics.com/217-4401.html

Is it absolutely necessary to use the breakout board? It may be messy, but could you accomplish the same thing without it? What exactly does it do? Is it just making it easier to use the SRX?

ozrien 16-05-2015 22:31

Re: Talon SRX and Analog Encoders
 
Quote:

Originally Posted by TBots (Post 1482575)
Is it absolutely necessary to use the breakout board? It may be messy, but could you accomplish the same thing without it? What exactly does it do? Is it just making it easier to use the SRX?

Here's a snippet from the link Ether mentioned....
Quote:

This breakout board is designed specifically for use with the Talon SRX - it scales a native 5V analog signal to a Talon SRX compliant 3.3V, helping 5V magnetic shaft encoders to "just work" without additional circuitry.
...
See section 1.4.7 of the Talon SRX User's Guide for more details.
So in other words the MA3 is a 0-5V sensor, but the Talon analog input takes 0-3.3V (also in electrical specs in user's guide).

Ether 16-05-2015 23:08

Re: Talon SRX and Analog Encoders
 
Quote:

Originally Posted by ozrien (Post 1482578)
Here's a snippet from the link Ether mentioned...

Gotta give Antoine credit for that link :-)



TBots 17-05-2015 00:10

Re: Talon SRX and Analog Encoders
 
Alright I understand what is it now, but is it the only way to turn 5V of analog signal to 3.3? I'm asking because while the breakout board would be helpful, it doesn't look like we will be getting it any time soon seeing how it is currently sold out.

I still think it might be possible to recreate it, but maybe I don't yet understand the uniqueness of it. The talon SRX user guide makes the comment that the board is useful in the aspect that is uses "a resistor divider and voltage buffer" to make the 5V to 3.3V transition. What are these, and where are they located on the board? Is is something to do with the A63A?

MaGiC_PiKaChU 17-05-2015 00:24

Re: Talon SRX and Analog Encoders
 
1 Attachment(s)
Quote:

Originally Posted by TBots (Post 1482597)
Alright I understand what is it now, but is it the only way to turn 5V of analog signal to 3.3? I'm asking because while the breakout board would be helpful, it doesn't look like we will be getting it any time soon seeing how it is currently sold out.

I still think it might be possible to recreate it, but maybe I don't yet understand the uniqueness of it. The talon SRX user guide makes the comment that the board is useful in the aspect that is uses "a resistor divider and voltage buffer" to make the 5V to 3.3V transition. What are these, and where are they located on the board? Is is something to do with the A63A?

we made a custom 5 to 3.3V converter on a breadboard at first...
pretty simple, but would highly recommend the breakouts with the designed cable

TBots 17-05-2015 00:43

Re: Talon SRX and Analog Encoders
 
What is the "Q1" in the diagram?

Did it still work with the breadboard design? I mean, was there a major flaw in it, or did the breakout board just work better?

Yes the breakout board would be preferable, but if there is no way to get it at this moment, we would like to try alternate methods.

MaGiC_PiKaChU 17-05-2015 00:54

Re: Talon SRX and Analog Encoders
 
Quote:

Originally Posted by TBots (Post 1482604)
What is the "Q1" in the diagram?

Did it still work with the breadboard design? I mean, was there a major flaw in it, or did the breakout board just work better?

Yes the breakout board would be preferable, but if there is no way to get it at this moment, we would like to try alternate methods.

breadboard works, just takes a lot of space... As this is an offseason project, you should be fine.
breakout also allows you to use multiple sensors easily on a single SRX.

this diagram is an easier circuit you could use. The other was working both ways

http://www.savagecircuits.com/attach...6&d=1430452949

TBots 17-05-2015 01:08

Re: Talon SRX and Analog Encoders
 
looks good :) Thank you for the help!

MaGiC_PiKaChU 17-05-2015 01:10

Re: Talon SRX and Analog Encoders
 
Quote:

Originally Posted by TBots (Post 1482608)
looks good :) Thank you for the help!

No problem :) Good luck with your project!

TBots 23-05-2015 23:18

Re: Talon SRX and Analog Encoders
 
The Talon SRX Software Manual mentions that "the Set Output VI is also the method for specifying the setpoint." How can this be? I thought all the set output VI did was change the motion of the motor specified to either clock-wise or counter clock-wise and at your chosen speed. how can it also change setpoint?

If you wanted to change the position of the motor to the 90 degree mark, what value would you enter? Normally the VI's values range from -1 to 1. So how can you place an angle? What would be the range of values?

MaGiC_PiKaChU 23-05-2015 23:27

Re: Talon SRX and Analog Encoders
 
i'm not sure about LabView, but with Java it's also the same command;

depending on the Control mode, the input will not have the same effect

for example, we used "PercentVBus" during teleop, which ranges from -1 to 1
we used it like this
Code:

talon.set(0.7);
//this sets the voltage output to the motor to 70% of the battery

During autonomous, we used "Position" , which ranges from 0 to 1024 (0V on the sensor to 3.3V)
we used it like this
Code:

talon.set(512);
//this sets the talon to 180 degrees, like a servo would do

I guess it's the same with Labview, but I might as well be wrong :yikes:

TBots 23-05-2015 23:32

Re: Talon SRX and Analog Encoders
 
I see what you mean. There is a similar command in labVIEW when initializing the Talon SRX objects to change it from PercentVBus to Position, I just never knew what it meant! Thanks for clearing that up!

TBots 24-05-2015 15:00

Re: Talon SRX and Analog Encoders
 
Ether, what did you mean when you said this?

Quote:

Originally Posted by Ether (Post 1482545)

use the appropriate CAN commands to set the gains in the Talon's PID controller.

Do you mean the difference in the current position of the encoder and the set point?

MaGiC_PiKaChU 24-05-2015 15:52

Re: Talon SRX and Analog Encoders
 
Quote:

Originally Posted by TBots (Post 1483940)
Ether, what did you mean when you said this?

Do you mean the difference in the current position of the encoder and the set point?

You have a command probably called "SetPID"... It allows you to place your parameters for the PID control, when you control with the position. You call this once before your control loop. if you never worked with PIDs before, I'm pretty sure Ether could help you :)

Ether 24-05-2015 16:26

Re: Talon SRX and Analog Encoders
 
Quote:

Originally Posted by TBots (Post 1483940)
Do you mean the difference in the current position of the encoder and the set point?

No. Watch this video. It explains what PID gains are.



TBots 24-05-2015 22:54

Re: Talon SRX and Analog Encoders
 
Ah I see, you just mean the constants associated with PID. :) I understand now.

How frequent is the tele-op code executed on the roboRIO?

I need to know so I can choose the sensitivity of the joystick. Ill then use the values of the joystick in the math for the set point.

Ether 25-05-2015 12:35

Re: Talon SRX and Analog Encoders
 
Quote:

Originally Posted by TBots (Post 1483995)
I need to know [TeleOp frequency] so I can choose the sensitivity of the joystick.

Please explain in a bit more detail what you mean.



MaGiC_PiKaChU 25-05-2015 13:10

Re: Talon SRX and Analog Encoders
 
Quote:

Originally Posted by Ether (Post 1484032)
Please explain in a bit more detail what you mean.

pretty sure he means how many times the roboRio runs the teleoperated loop very second...

I guess it depends how much code you run... you can find the number of iteration by printing the time each time you enter the loop... I don't know how that is useful for your PID control tough :confused:

Ether 25-05-2015 14:02

Re: Talon SRX and Analog Encoders
 

Let me try again:

Quote:

Originally Posted by TBots (Post 1483995)
I need to know [TeleOP frequency] so I can choose the sensitivity of the joystick

@Tbots: ..Please explain in a bit more detail the relationship between the TeleOp frequency and the bolded portion above.




TBots 29-05-2015 15:44

Re: Talon SRX and Analog Encoders
 
In order to scale -1 to 1, the normal scale of the joystick, to 0 to 1024, we would have to add one and multiply by 512 the original value of the joystick. The problem is, since we would be using a joystick, whoever was driving would have to hold that position on the joystick else the wheel would return back to the the 512th position.

The only way I can think to avoid this, is if a button would increase the value of the angle while another one lowered it. The only problem is I'd have to know how often the tele-op vi was executed. Otherwise I wouldn't know by how much to increase the value. In other words, I wouldn't know how sensitive to make the joystick.

In the case that the button was held down, the wheel may have too large of an increase in angle and mess up the wires of the wheel. This is why I'd need to know how long it takes tele-op to execute, in order to determine what magnitude the decrease/increase would need to be.

TBots 29-05-2015 16:12

Re: Talon SRX and Analog Encoders
 
MaGiC_PiKaChU, when connecting the encoders with the data cable and using a breadboard and resistors, how did you connect the data cable? It has two rows of holes in it, each with 5 holes. 2x5. How did you connect these to the breadboard?

Also, do you have to have a d-link connected to the robot in order to enter web-based configuration? We've never used web-based configuration, but we need to use it to configure the SRX.

randantor 29-05-2015 16:31

Re: Talon SRX and Analog Encoders
 
In LabVIEW, the Teleop VI runs every time the robot receives a packet from the driver station, so the delay could be pretty irregular.

A way to achieve what I think you're looking for would be to measure the time delta between each run of Teleop, and multiply that by the joystick value before applying the scaling factor and integrating, to ensure that the joystick power is being applied "evenly" with respect to time.

For example:

MaGiC_PiKaChU 29-05-2015 16:46

Re: Talon SRX and Analog Encoders
 
Quote:

Originally Posted by TBots (Post 1484894)
MaGiC_PiKaChU, when connecting the encoders with the data cable and using a breadboard and resistors, how did you connect the data cable? It has two rows of holes in it, each with 5 holes. 2x5. How did you connect these to the breadboard?

Also, do you have to have a d-link connected to the robot in order to enter web-based configuration? We've never used web-based configuration, but we need to use it to configure the SRX.

1- we had tons of data cables, so we cut one side to connect each wire individually... you could also plug a small wire into each hole, but that would be harder

2- No, your RoboRio has its own IP address, it changes if you connect via USB or ethernet. I don't remember the defaults, because we changed it to 10.33.60.2 as soon as we got it. You can find this address somewhere in the user's manual :D

TBots 29-05-2015 18:09

Re: Talon SRX and Analog Encoders
 
Quote:

Originally Posted by MaGiC_PiKaChU (Post 1484898)
1- we had tons of data cables, so we cut one side to connect each wire individually... you could also plug a small wire into each hole, but that would be harder

Cutting them would make it hard to plug them into the breakout board later. :( Just the same, we have had a lot of difficulty trying to find wires small enough to fit into the data cable's slots. Do you know what each hole does on the data cable?

Quote:

Originally Posted by MaGiC_PiKaChU (Post 1484898)
2- No, your RoboRio has its own IP address, it changes if you connect via USB or ethernet. I don't remember the defaults, because we changed it to 10.33.60.2 as soon as we got it. You can find this address somewhere in the user's manual :D

The IP changes?? you mean it's not “roborio-XXXX.local”
where XXXX is the team number? It has an extension such as .2 or .6?

TBots 29-05-2015 18:13

Re: Talon SRX and Analog Encoders
 
Quote:

Originally Posted by randantor (Post 1484896)
A way to achieve what I think you're looking for would be to measure the time delta between each run of Teleop, and multiply that by the joystick value before applying the scaling factor and integrating, to ensure that the joystick power is being applied "evenly" with respect to time.

I've never heard of measuring time, but it sounds like a great idea! Ill see if I can find it.

Thank you for the help! :)

MaGiC_PiKaChU 29-05-2015 21:25

Re: Talon SRX and Analog Encoders
 
1 Attachment(s)
Quote:

Originally Posted by TBots (Post 1484917)
Cutting them would make it hard to plug them into the breakout board later. :( Just the same, we have had a lot of difficulty trying to find wires small enough to fit into the data cable's slots. Do you know what each hole does on the data cable?

see my thumbnail

Quote:

Originally Posted by TBots (Post 1484917)
The IP changes?? you mean it's not “roborio-XXXX.local”
where XXXX is the team number? It has an extension such as .2 or .6?

I don't remember... as long as you find the right IP you'll be able to configure your SRX... I always connected using 10.33.60.2, in my case


All times are GMT -5. The time now is 20:15.

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