Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Technical Discussion (http://www.chiefdelphi.com/forums/forumdisplay.php?f=22)
-   -   Arduino Micro with Talon SR (http://www.chiefdelphi.com/forums/showthread.php?t=137455)

Ether 08-06-2015 16:15

Re: Arduino Micro with Talon SR
 
Quote:

Originally Posted by Rman1923 (Post 1486157)
Does anyone know how to calibrate the SR so it doesn't go reverse

Quote:

Originally Posted by emileh3467 (Post 1486171)
Here are the calibration instructions...

So, using the instructions you posted, how would you propose to "calibrate the SR so it doesn't go reverse" ?




Alan Anderson 08-06-2015 16:19

Re: Arduino Micro with Talon SR
 
Quote:

Originally Posted by Rman1923 (Post 1486157)
Does anyone know how to calibrate the SR so it doesn't go reverse, I'm making an electric skateboard and don't plan to parallel park.

You can't "calibrate" it to only go one direction. If you try giving it only forward commands while calibrating it, the procedure will fail and the calibration will not be changed. The Talon SR doesn't have limit switch inputs, so the simple option of permanently activating the "reverse" limit is not available either.

The obvious answer is just to only send it "forward" commands, using pulse widths between 1.5 and 2.0 milliseconds. Never give it anything less than 1.5 milliseconds, and it will never go in reverse.

billbo911 08-06-2015 16:26

Re: Arduino Micro with Talon SR
 
Quote:

Originally Posted by AdamHeard (Post 1486116)
I'd skip the servo function and instead use servo.writeMicroseconds.

Cleaner control numerically.

1000 is rev, 1500 neutral, 2000 forward.

Quote:

Originally Posted by AdamHeard (Post 1486150)
You're missing what I'm saying. servo.write() takes 0 to 180 degrees as an input and controls a "Servo". servo.writeMicroseconds() explicitly takes the pulse you would like to generate, which for a talon is 1000-2000 w/ 1500 at center. This leaves you a nice +/- 500 integer swing for clean math.

This is my experience as well. I do it this way because I get higher resolution of the command signal. It allows more precise control of the motor or servo.
Now, if you only need +/- 90 steps instead of +/- 500, then using servo.writeMicroseconds has no advantage.

Andrew Schreiber 08-06-2015 16:59

Re: Arduino Micro with Talon SR
 
Quote:

Originally Posted by billbo911 (Post 1486177)
This is my experience as well. I do it this way because I get higher resolution of the command signal. It allows more precise control of the motor or servo.
Now, if you only need +/- 90 steps instead of +/- 500, then using servo.writeMicroseconds has no advantage.

Does the Talon actually respond with that granularity? I recall seeing a post years back about the old Vic 884s that basically said they only had 90-odd actual values and the rest were just duplicates.

AdamHeard 08-06-2015 17:38

Re: Arduino Micro with Talon SR
 
Quote:

Originally Posted by Andrew Schreiber (Post 1486180)
Does the Talon actually respond with that granularity? I recall seeing a post years back about the old Vic 884s that basically said they only had 90-odd actual values and the rest were just duplicates.

I'm looking now and not finding where I read this (so it may be false), but I believe the talons interpret the pwm input as a 10 bit number, so roughly 1:1 mapping over that 1000-2000 range.

josesantos 08-06-2015 18:22

Re: Arduino Micro with Talon SR
 
Quote:

Originally Posted by AdamHeard (Post 1486186)
I'm looking now and not finding where I read this (so it may be false), but I believe the talons interpret the pwm input as a 10 bit number, so roughly 1:1 mapping over that 1000-2000 range.

Yeah, user manual says 10-bit (1024 steps)

SuperBK 09-06-2015 17:19

Re: Arduino Micro with Talon SR
 
You can also specify the servo min and max pulse widths in the attach call:

Servo driveServo;
driveServo.attach(3, 1000, 2000); // TALON // widths are in micro-seconds

Then use servo.Write() 0 is reverse, 90 is stop, and 180 is full forward.

I would still calibrate the Talon (or other motor controller) to ensure it goes full speed. Write an arduino sketch that starts at neutral and waits for a character to arrive from the serial port. Then have it switch to servo to full speed forward, wait for another character and then go full reverse. After waiting for another character, go to neutral. Use Serial.Print to tell the user whats going on and prompt for a character. If you use the serial port monitor in the arduino IDE, you will have to click the "Send" button after each key.

One other thing: I put a 330 ohm resistor in series with the white wire driving the PWM input on the Talon so it doesn't try to drive too much current through its input opto-isolator.

AdamHeard 09-06-2015 17:34

Re: Arduino Micro with Talon SR
 
Quote:

Originally Posted by SuperBK (Post 1486294)
You can also specify the servo min and max pulse widths in the attach call:

Servo driveServo;
driveServo.attach(3, 1000, 2000); // TALON // widths are in micro-seconds

Then use servo.Write() 0 is reverse, 90 is stop, and 180 is full forward.

Why do this versus explicitly writing the 1000 to 2000 range?

GeeTwo 09-06-2015 18:00

Re: Arduino Micro with Talon SR
 
Quote:

Originally Posted by AdamHeard (Post 1486296)
Why do this versus explicitly writing the 1000 to 2000 range?

If you were using something other than a Talon, you would only have to change the initial attach call; the rest of the code wouldn't need to be modified. For example, a jaguar would be attached with:
Code:

driveServo.attach(3, 670, 2330); // Jaguar
Of course, for a motor controller, you'd ideally like the input limits to be a float ranging from -1 to +1.

Rman1923 09-06-2015 18:00

Re: Arduino Micro with Talon SR
 
Quote:

Originally Posted by SuperBK (Post 1486294)
You can also specify the servo min and max pulse widths in the attach call:

Servo driveServo;
driveServo.attach(3, 1000, 2000); // TALON // widths are in micro-seconds

Then use servo.Write() 0 is reverse, 90 is stop, and 180 is full forward.

I would still calibrate the Talon (or other motor controller) to ensure it goes full speed. Write an arduino sketch that starts at neutral and waits for a character to arrive from the serial port. Then have it switch to servo to full speed forward, wait for another character and then go full reverse. After waiting for another character, go to neutral. Use Serial.Print to tell the user whats going on and prompt for a character. If you use the serial port monitor in the arduino IDE, you will have to click the "Send" button after each key.

One other thing: I put a 330 ohm resistor in series with the white wire driving the PWM input on the Talon so it doesn't try to drive too much current through its input opto-isolator.

This is pretty cool, I'm going to try this. Do you think if I mod the servo call to attach(1500,2000) it will only go forward? Also, I can just do the digitalwrite() function to control this right?
Thanks!

AdamHeard 09-06-2015 19:23

Re: Arduino Micro with Talon SR
 
Quote:

Originally Posted by GeeTwo (Post 1486298)
If you were using something other than a Talon, you would only have to change the initial attach call; the rest of the code wouldn't need to be modified. For example, a jaguar would be attached with:
Code:

driveServo.attach(3, 670, 2330); // Jaguar
Of course, for a motor controller, you'd ideally like the input limits to be a float ranging from -1 to +1.

Depending on how fast all this is running (and what else is going on) using floats may be out of the question due to the slower math.

GeeTwo 09-06-2015 20:56

Re: Arduino Micro with Talon SR
 
Quote:

Originally Posted by AdamHeard (Post 1486308)
Depending on how fast all this is running (and what else is going on) using floats may be out of the question due to the slower math.

I did say ideally!

I'm fully aware of the need to program for integers in some cases. I even wrote a fully integer semi-swerve drive inverse kinematics a few years ago. My semi-swerve platform was about 1/3 FRC scale, with a 0-180 degree maximum steering angle steered by servos, and 25mm 1000rpm gear motors for drive, and yes, it was controlled with an Arduino. Unfortunately, the only hard drive that the code was on has since died. The key was that I wrote a hypoti(x,y) subroutine that calculated an integer hypotenuse using max(x, y) and the ratio 256 * min(x,y) / max(x,y) (where x and y were preprocessed to be non-negative), and an atan2id(y,x) that returned atan2(y,x) in degrees based on the same ratio, whether abs(x) or abs(y) was larger, and the two input signs. IIRC, the atan2id() routine had two separate cubic fits to cover the span from 0 to 45 degrees, that broke based on whether 2*min(x,y)/max(x,y) was 0 or 1 (that is, at about 28.8 degrees).

teslalab2 13-06-2015 01:37

Re: Arduino Micro with Talon SR
 
Quote:

Originally Posted by Rman1923 (Post 1486105)
Thanks All, I figured it out, you have to connect the red to the VCC (5V or 3.3V depending on the board) black to ground and then the white one to a PWM pin. I used the Servo library and read the vals from a potentiameter and fed them to the talon during calibration. Now if i could get the underglow working...

you don't believe me when I say power is not connected to anything? :p just trying to save trouble, it really only needs signal and ground. red serves no purpose and is no internally hooked up to anything inside that talon :cool:

Rman1923 13-06-2015 23:30

Re: Arduino Micro with Talon SR
 
Quote:

Originally Posted by teslalab2 (Post 1486634)
you don't believe me when I say power is not connected to anything? :p just trying to save trouble, it really only needs signal and ground. red serves no purpose and is no internally hooked up to anything inside that talon :cool:

Actually, I had it set up without red, but then the talon didn't work. The PWM powers as well as controls the talon. The talon is not (and can't be) powered by the input voltage. It confused me at first as well lol.

Alan Anderson 14-06-2015 17:16

Re: Arduino Micro with Talon SR
 
Quote:

Originally Posted by Rman1923 (Post 1486706)
Actually, I had it set up without red, but then the talon didn't work. The PWM powers as well as controls the talon. The talon is not (and can't be) powered by the input voltage. It confused me at first as well lol.

Unless your Talon differs from every one I have ever seen, you are mistaken. The center pin on the Talon's PWM connector is not connected to anything inside it. The Talons (and Victors, and Jaguars) are indeed powered by the same input voltage that is routed (and regulated) to the motor outputs.


All times are GMT -5. The time now is 02:13.

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