|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: [C++] Use CAN Talons in RobotDrive
What sort of problems are you encountering when you try to run the mecanum drive code? Does it simply not do anything at all, does it move the motors around but not in the way you expect, or something else? If the motors are running but the robot is responding how you expect, you should double check that everything is plugged into the right ports, that all the motors are turning the right direction, etc.
|
|
#2
|
|||
|
|||
|
Re: [C++] Use CAN Talons in RobotDrive
Quote:
Quote:
Quote:
|
|
#3
|
|||
|
|||
|
Re: [C++] Use CAN Talons in RobotDrive
try calling
robotDrive.SetSafetyEnabled(false); before the while loop in OperatorControl. Edit: actually, try calling that in the Robot() constructor. It's possible that the Talons are getting disabled before you start running the robot but that they aren't getting properly re-enabled. Last edited by James Kuszmaul : 31-01-2015 at 20:59. |
|
#4
|
|||
|
|||
|
Re: [C++] Use CAN Talons in RobotDrive
I actually tried that earlier when I had some motor controllers set up wrong, but I forgot to try it again! I'll check back tomorrow and report if it worked or not.
|
|
#5
|
||||
|
||||
|
Re: [C++] Use CAN Talons in RobotDrive
If you are seeing kNoDrive then most likely set is not being called. See software reference manual for more details.
|
|
#6
|
|||
|
|||
|
Re: [C++] Use CAN Talons in RobotDrive
Can I just call Set() once at the beginning of teleop or is there something I have to change in RobotDrive? Unfortunately, I can't test until Monday.
|
|
#7
|
||||
|
||||
|
Re: [C++] Use CAN Talons in RobotDrive
Are you calling Wait(.01) in your code? That may cause the code to do nothing.
|
|
#8
|
|||
|
|||
|
Re: [C++] Use CAN Talons in RobotDrive
Could also try creating a new project. Sometimes projects get messed up. On the surface, it may not seem like it matters, but it could be worth a try.
I reccomend you switch from using the SampleRobot project to using IterativeRobot and try the code again. Last edited by viggy96 : 01-02-2015 at 00:17. |
|
#9
|
|||
|
|||
|
Re: [C++] Use CAN Talons in RobotDrive
This should work, but as I don't have a bot with TalonSRXs, I can't confirm this, but you could try it. I have used the IterativeRobot class.
Code:
class Robot: public IterativeRobot
{
private:
LiveWindow *lw;
CANTalon leftFront = new CANTalon(1);
CANTalon leftBack = new CANTalon(5);
CANTalon rightFront = new CANTalon(2);
CANTalon rightBack = new CANTalon(6);
RobotDrive drive = new RobotDrive(leftFront, leftBack, rightFront, rightBack);
Joystick stick = new Joystick(1);
Gyro gyro = new gyro(0);
void RobotInit()
{
lw = LiveWindow::GetInstance();
}
void AutonomousInit()
{
}
void AutonomousPeriodic()
{
}
void TeleopInit()
{
}
void TeleopPeriodic()
{
drive.MecanumDrive_Cartesian(stick.getX(), stick.getY(), stick.getThrottle(), gyro.getAngle());
}
void TestPeriodic()
{
lw->Run();
}
};
|
|
#10
|
|||
|
|||
|
Re: [C++] Use CAN Talons in RobotDrive
How would this be different than the code I started with? Iterative basically just adds a function to be called at the beginning, but doesn't really change what is actually going on in the program.
|
|
#11
|
||||
|
||||
|
Re: [C++] Use CAN Talons in RobotDrive
Quote:
Either way, you should add some sleep to your loop, otherwise you'll starve the rest of the threads on your system and you'll encounter problems. I'd recommend using iterative robot instead though, then you don't have to worry about things like that. |
|
#12
|
|||
|
|||
|
Re: [C++] Use CAN Talons in RobotDrive
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|