|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#16
|
||||
|
||||
|
Re: Arduino Micro with Talon SR
Quote:
|
|
#17
|
|||||
|
|||||
|
Re: Arduino Micro with Talon SR
Quote:
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. |
|
#18
|
||||
|
||||
|
Re: Arduino Micro with Talon SR
Quote:
Quote:
Now, if you only need +/- 90 steps instead of +/- 500, then using servo.writeMicroseconds has no advantage. |
|
#19
|
|||
|
|||
|
Re: Arduino Micro with Talon SR
Quote:
|
|
#20
|
|||||
|
|||||
|
Re: Arduino Micro with Talon SR
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.
|
|
#21
|
||||
|
||||
|
Re: Arduino Micro with Talon SR
Quote:
|
|
#22
|
||||
|
||||
|
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. |
|
#23
|
|||||
|
|||||
|
Re: Arduino Micro with Talon SR
Why do this versus explicitly writing the 1000 to 2000 range?
|
|
#24
|
|||||
|
|||||
|
Re: Arduino Micro with Talon SR
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 |
|
#25
|
||||
|
||||
|
Re: Arduino Micro with Talon SR
Quote:
Thanks! |
|
#26
|
|||||
|
|||||
|
Re: Arduino Micro with Talon SR
Quote:
|
|
#27
|
|||||
|
|||||
|
Re: Arduino Micro with Talon SR
Quote:
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). |
|
#28
|
||||
|
||||
|
Re: Arduino Micro with Talon SR
Quote:
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 ![]() |
|
#29
|
||||
|
||||
|
Re: Arduino Micro with Talon SR
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.
|
|
#30
|
|||||
|
|||||
|
Re: Arduino Micro with Talon SR
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.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|