![]() |
Programming Mecanum Wheels - 4 Victors
Okay, so I've been working on testing my code on a practice bot and need help. I'm using an Attack 3 Joystick (I have 2 ) and a robot with 4 mecanum wheels, each with 4 victors.
Problem is: I have the sample code for a 2 motor robot and am having trouble creating a 4 motor drivetrain and using mecanum wheels. I create the drive system by doing this: RobotDrive *myRobot; Joystick stick; then myRobot = new Robotdrive(1,2,3,4); stick = new Joystick(1); then under operator control I write, myRobot->MecanumDrive_Cartesian(stick->GetX(),stick->GetY(),stick-> getTwist()); Except this isn't working. Do I need to declare something specific for the victors or logitech attack 3 joystick? And am I assigning the one joystick to control the whole robotdrive? I really need some help, anything would be appreciated at this point. Thank you in advance! |
Re: Programming Mecanum Wheels - 4 Victors
just a couple things jumping out at me...
|
Re: Programming Mecanum Wheels - 4 Victors
Okay thank you. Would I have to declare the Victors then too, or does WPI's API handle that? Thank you for any help.
|
Re: Programming Mecanum Wheels - 4 Victors
By default, the RobotDrive class will instantiate Jaguars as its motor controllers. If you are using Victors you need to explicitly instantiating them yourself and use the following constructor instead:
Code:
RobotDrive(SpeedController *frontLeftMotor,Code:
class MyRobot: public SimpleRobot |
Re: Programming Mecanum Wheels - 4 Victors
Okay so here is where I stand, don't have a chance to test it on the practice bot today but will tomorrow. Anyone got any advice on the program and is there anything essential I should add or do to this program? Not totally sure how to do the twist part for the Mecanum wheels using an Attack3 joystick...
Here it is: Code:
#include "WPILib.h" |
Re: Programming Mecanum Wheels - 4 Victors
No, your code just declared four Victor pointers but you did not instantiate them. Regarding the Attack3 joystick, can't help you on that since I am not familiar with it.
Code:
#include "WPILib.h" |
Re: Programming Mecanum Wheels - 4 Victors
Oh wait my bad - forgot to do that....thank you. And do you know if I should program anything to handle switching between operator control and autonomous - or will this program automatically handle that during competition?
|
Re: Programming Mecanum Wheels - 4 Victors
Quote:
|
Re: Programming Mecanum Wheels - 4 Victors
Ah, was just wondering how each part of the game is handled. And last question (I promise!) - if I have lets say a jaguar powering a belt that moves the ball, how could I go about programming that? I'm lost on how to control motors that does not involve the wheels.
Thank you in advance. |
Re: Programming Mecanum Wheels - 4 Victors
Quote:
Code:
Jaguar *beltMotor; |
Re: Programming Mecanum Wheels - 4 Victors
Okay thank you!
|
Re: Programming Mecanum Wheels - 4 Victors
Quote:
Code:
void OperatorControl(void) |
Re: Programming Mecanum Wheels - 4 Victors
Alright, thank you! However, I was sure everything was ready to go but now im getting a watchdog not fed error. I feed the watchdog but its not working. Does anyone know how to fix this?
Code:
#include "WPILib.h" |
Re: Programming Mecanum Wheels - 4 Victors
Anyone know how to fix this watchdog not fed error? I really need help badly right now and have spent 2 hours trying to figure it out...
|
Re: Programming Mecanum Wheels - 4 Victors
Quote:
Move the printf function outside the while loop, right now it gets called so often it might screw up the timing. HTH |
| All times are GMT -5. The time now is 13:40. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi