![]() |
Talon SRX spamming forward and backward constantly
Hello everybody,
So our robot's Talon's are reversing forward and backward during teleOP and Auton. During the Auton program it's set to move forward a single motor at half speed for half a second then stop. What actually happens is 2 motors continually go forward and backward at full speed(I think). We have the Talons in a CAN daisy chain sequence and are using c++ to program it. Any help would be much appreciated. |
Re: Talon SRX spamming forward and backward constantly
Can you post the code you're using to control said motors? (Just to eliminate the possibility of the code being the issue).
|
Re: Talon SRX spamming forward and backward constantly
Try calibrating it. That might solve the problem if it is not codes problem.
|
Re: Talon SRX spamming forward and backward constantly
My spitball guess is that both Talons have the same CAN address, and one is on the left side of the robot, and the other is on the right side of the robot. When you send the command, both motors respond by rotating in the same direction. However, as the motors are oriented in opposite directions, one of them appears to be going backward.
|
Re: Talon SRX spamming forward and backward constantly
Do you ever explicitly tell the motors to stop moving?
|
Re: Talon SRX spamming forward and backward constantly
I think Wenry may be in class, so his responses will be a bit delayed. I was at the build last night and helped him with his troubleshooting, so I will take a stab at answering your questions.
@Asymons - I don't have direct access to the code that was being used (it hasn't been pushed to our repo yet), but the final test was really simple. I'll try to replicate it here. We had a command with the following methods: Code:
void TestTalonCommand::Initialize()The setMotorSpeed method is in our subclass of RobotDrive, and implemented like this: Code:
void Drive::setMotorSpeed(unsigned int motorID, float speed)The Talons are in kThrottle or kPercentVbus mode (Both are names for ControlMode 0). @Munchskull - I was wondering about that, but since the robot uses CAN instead of PWM I didn't think normal calibration applied. At least, I couldn't find anything in the Talon SRX User Guide for calibrating the Talons for CAN. Do you have documentation on how we could do this? @GeeTwo - All of the Talons have unique IDs in the web interface. They are also all using the latest (1.4) version of the firmware. @Christopher149 - Yes. This is the part that is exceptionally puzzling. When the move command is sent (either by moving the joystick or by calling Set()) the motors begin moving. However, when the joystick is returned to center or the command ends, the motors do not stop until the robot is disabled. Thanks to all of you for responding. |
Re: Talon SRX spamming forward and backward constantly
PWM Calibration has no effect when controlling Talon SRXs over CAN bus.
It sounds like a programming issue, can you just post it in it's entirety? Or PM me a link and I can run it on my robot. |
Re: Talon SRX spamming forward and backward constantly
Sorry if this doesn't look pretty i'm new to forms. Also if i should add anything else just let me know please. Thank you for helping
TestTalonCommand.cpp file Code:
#include "TestTalonCommand.h"Code:
#ifndef TEST_TALON_COMMAND_HCode:
#include "MecanumDriveTrain.h"Code:
#ifndef MECANUM_DRIVE_TRAIN_H#ifndef ENCODER_DRIVE_H Code:
#define ENCODER_DRIVE_HCode:
#include "EncoderDrive.h" |
Re: Talon SRX spamming forward and backward constantly
Also here is the link to our repository https://github.com/FRC2539/command-based/tree/rrush. Thanks all for the help.
|
Re: Talon SRX spamming forward and backward constantly
Arrived at the build site, here's what we're dealing with https://www.youtube.com/watch?v=_ALFjkahQuk. Thanks again for the help.
|
Re: Talon SRX spamming forward and backward constantly
Quote:
|
Re: Talon SRX spamming forward and backward constantly
Quote:
|
Re: Talon SRX spamming forward and backward constantly
Quote:
|
Re: Talon SRX spamming forward and backward constantly
We are having very similar problems with our drive system. We are running Talon SRX's using CAN and mechanum drive using C++ IterativeRobot. We have some motors not turning and others spin slowly in the wrong direction while other motors are running at full speed. We are also seeing some CAN errors from the PDB not responding on the DriverStation messages.
The Talons all have unique CAN IDs and have had a firmware update (from memory, I think they're running version 1.4). Same with the PDB (I think it's firmware level is 1.37). We are driving the motors using the RobotDrive. 2539: If you figure this out, please post your solution. I was going to try increasing the control period on the CANTalon's, but I'm not confident this will work. Thanks |
Re: Talon SRX spamming forward and backward constantly
There is definitely something wrong with that robot app. Running it on my bot it looks like two things are trying to drive all the Talons, it keeps switching between zero and nonzero values. I'll keep digging...
|
Re: Talon SRX spamming forward and backward constantly
Quote:
|
Re: Talon SRX spamming forward and backward constantly
Well to sanity checks things I grabbed the stock example at ...
http://wpilib.screenstepslive.com/s/...-mecanum-drive ...and tweaked it a bit. It is just mechanum drive with CANTalons and no gyro. I... -changed the Talons to CANTalons and used 1,3,4,5 for the device IDs to match your bot. Although I did NOT cross-reference your code to make sure the number-to-positions matched (LF,LR,RF,RR). -I increased the motor safety timeout to 500ms. Seems like the default is not long enough to cover the time between enabling and getting to the first TeleopOpLoop. -Changed the joystick index to 0 from 1. To use this example just create a new IterativeRobot and paste this into Robot.cpp. Code:
#include "WPILib.h"/** |
Re: Talon SRX spamming forward and backward constantly
If you don't have any load on the drive wheels when you try to control the speed in closed-loop mode, you're very likely to get wildly oscillating wheels as they overshoot the target speed and try to correct.
Try giving them some load, like a patch of carpet pressed lightly against the rollers. You might also try adding some rate limiting on the motor power to keep it from thrashing so badly. |
Re: Talon SRX spamming forward and backward constantly
Our head mentor uploaded some new code to get and it seemed to work. However the controls are off. See the video. https://www.youtube.com/watch?v=uDY6QJa7FKw Thanks everyone for there help and especially ozrien for putting the code on your robot. Tomorrow I'll post how he was able to fix it but for now sleep and class.
|
Re: Talon SRX spamming forward and backward constantly
Got this working on my bot. I used 3,1,4,5 for LeftFront, LeftRear, RightFront, RightRear respectively. Also added gyro an analog0 so holds absolute angle.
-I use the F350-similar gamepad (the wireless version), so I changed the three axes to X,Y,Z. -Also I added button5 so that it will reset angle, thus allowing you to reselect the angle heading to servo to. -Also inverted my right side since right-side motors have to drive negative (red) to move robot forward. Actually I've been playing with this for about half an hour, driving it around the CTR office, so it seems pretty good. Code:
#include "WPILib.h" |
Re: Talon SRX spamming forward and backward constantly
Quote:
|
Re: Talon SRX spamming forward and backward constantly
Quote:
Quote:
Basically two Common-ID talons can't be enabled at the same time. One will win while the other stays disabled. Also there will be instances when both disable. When a Talon SRX is disabled it will blink orange each LED in an alternate pattern (think rail road crossing). See Talon User Guide for LED table. |
Re: Talon SRX spamming forward and backward constantly
So it turned out that we only disabled half of our encoders. We had old code running the encoders even though we bypassed the joystick inputs. Whenever we tried to move our motors the old code kicked in and tried to bring the wheels back to 0, but overshot and just continued to do so. Thanks everyone for all the help! So mandrews281 make sure you have all your PID loops disabled.
|
Re: Talon SRX spamming forward and backward constantly
There are no PIDs in our code. It's only 4 TalonSRX, a robotdrive, a Gyro (disabled I think, need to check with my programming captain) and joystick. I saw 1452-Leo's solution here:
http://www.chiefdelphi.com/forums/sh...5&postcount=20 and I'm thinking that's the way to go. Our electrical team has our test base disassembled at the moment, I'll have to try this tomorrow. |
Re: Talon SRX spamming forward and backward constantly
Quote:
Is your problem that you are seeing motor safety errors in the DS AND as a result your motors are neutral (solid orange)? Please be specific. |
| All times are GMT -5. The time now is 21:10. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi