|
Page 1 of 1
|
[ 3 posts ] |
|
| Author |
Message |
|
kervyn
Rookie
Joined: Fri Feb 11, 2011 9:07 am Posts: 2
|
 joystick controller
hi guys=D we are the Singapore team going for the ftc competition. so, we just got the parts and programming software 1 week ago after waiting for 1 month. This is the first time we are using robotc and we have no people teaching us so please help us. we are already having problem with tele-op and pl dont get us started on autonomous period. so please help us.
#pragma config(Hubs, S1, HTMotor, HTMotor, none, none) #pragma config(Motor, motorA, kickMotor, tmotorNormal, PIDControl, encoder) #pragma config(Motor, motorB, leftGrabber, tmotorNormal, PIDControl, encoder) #pragma config(Motor, motorC, rightGrabber, tmotorNormal, PIDControl, encoder) #pragma config(Motor, mtr_S1_C1_1, leftMotors, tmotorNormal, PIDControl, encoder) #pragma config(Motor, mtr_S1_C1_2, rightMotors, tmotorNormal, PIDControl, encoder) #pragma config(Motor, mtr_S1_C2_1, armMotors, tmotorNormal, PIDControl, reversed, encoder) #pragma config(Motor, mtr_S1_C2_2, motorG, tmotorNormal, openLoop)
#include "JoystickDriver.c" //Include file to incoperate Bluetooth messages.
task main() { initializeRobot();
waitForStart(); // wait for start of tele-op phase
int thresholdP = 10; int thresholdN =-10;
while (true) { getJoystickSettings(joystick); if(abs((joystick.joy1_y1)) > thresholdP);
motor[leftMotors] = (joystick.joy1_y1);
motor[leftMotors] = 0; { motor[leftMotors] = (joystick.joy1_y1); } if(abs((joystick.joy1_y2)) > thresholdP); { motor[rightMotors] = -(joystick.joy1_y2);
motor[rightMotors] = (joystick.joy2_y2);
motor[leftMotors] = (joystick.joy2_y1); } } } This is our program we are not sure why our both controllers are not working so please help we are very desperate.
|
| Fri Feb 11, 2011 9:16 am |
|
 |
|
ThePaperplaneologist
Rookie
Joined: Wed Feb 09, 2011 7:28 pm Posts: 14
|
 Re: joystick controller
 |  |  |  | kervyn wrote: hi guys=D we are the Singapore team going for the ftc competition. so, we just got the parts and programming software 1 week ago after waiting for 1 month. This is the first time we are using robotc and we have no people teaching us so please help us. we are already having problem with tele-op and pl dont get us started on autonomous period. so please help us.
#pragma config(Hubs, S1, HTMotor, HTMotor, none, none) #pragma config(Motor, motorA, kickMotor, tmotorNormal, PIDControl, encoder) #pragma config(Motor, motorB, leftGrabber, tmotorNormal, PIDControl, encoder) #pragma config(Motor, motorC, rightGrabber, tmotorNormal, PIDControl, encoder) #pragma config(Motor, mtr_S1_C1_1, leftMotors, tmotorNormal, PIDControl, encoder) #pragma config(Motor, mtr_S1_C1_2, rightMotors, tmotorNormal, PIDControl, encoder) #pragma config(Motor, mtr_S1_C2_1, armMotors, tmotorNormal, PIDControl, reversed, encoder) #pragma config(Motor, mtr_S1_C2_2, motorG, tmotorNormal, openLoop)
#include "JoystickDriver.c" //Include file to incoperate Bluetooth messages.
task main() { initializeRobot();
waitForStart(); // wait for start of tele-op phase
int thresholdP = 10; int thresholdN =-10;
while (true) { getJoystickSettings(joystick); if(abs((joystick.joy1_y1)) > thresholdP);
motor[leftMotors] = (joystick.joy1_y1);
motor[leftMotors] = 0; { motor[leftMotors] = (joystick.joy1_y1); } if(abs((joystick.joy1_y2)) > thresholdP); { motor[rightMotors] = -(joystick.joy1_y2);
motor[rightMotors] = (joystick.joy2_y2);
motor[leftMotors] = (joystick.joy2_y1); } } } This is our program we are not sure why our both controllers are not working so please help we are very desperate. |  |  |  |  |
Well, I don't quite understand what you are trying to accomplish with this code, but I think I can help some. It seems to me that as soon as you turn a motor on, you turn it off or change its direction. If you want some code where the left joystick of controller one (joystick.joy1_y1) controls the left motors and the right joystick of controller one (joystick.joy1_y2) controls the right motors, then I might do something like this: By the way, don't have a semicolon at the end of your if statement. It is improper syntax but the RobotC compiler doesn't notice it. I once did that and the if statement always read true.  Hope this helps.
|
| Fri Feb 11, 2011 10:37 am |
|
 |
|
kervyn
Rookie
Joined: Fri Feb 11, 2011 9:07 am Posts: 2
|
 Re: joystick controller
thanks did not know that=D thanks a lot=D
|
| Fri Feb 11, 2011 10:42 am |
|
|
|
Page 1 of 1
|
[ 3 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 4 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|