|
Page 1 of 1
|
[ 5 posts ] |
|
1 Controller, 2 Control Schemes?
| Author |
Message |
|
JhaneelJha
Rookie
Joined: Thu Mar 01, 2012 9:11 pm Posts: 6
|
 1 Controller, 2 Control Schemes?
Our robot picks up crates but it has a very narrow sweet spot to grab them. I was thinking of testing a double control scheme. When button 5 is pressed a second drive train control system should kick in. It would work something like this.  |  |  |  | Code: #pragma config(Hubs, S1, HTServo, HTMotor, HTMotor, HTMotor) #pragma config(Sensor, S1, , sensorI2CMuxController) #pragma config(Motor, mtr_S1_C2_1, liftr, tmotorNormal, openLoop) #pragma config(Motor, mtr_S1_C2_2, cnv, tmotorNormal, openLoop) #pragma config(Motor, mtr_S1_C3_1, liftl, tmotorNormal, openLoop) #pragma config(Motor, mtr_S1_C3_2, motorG, tmotorNone, openLoop) #pragma config(Motor, mtr_S1_C4_1, rightm, tmotorNormal, openLoop, reversed) #pragma config(Motor, mtr_S1_C4_2, leftm, tmotorNormal, openLoop, reversed) #pragma config(Servo, srvo_S1_C1_1, clamp, tServoStandard) #pragma config(Servo, srvo_S1_C1_2, servo2, tServoNone) #pragma config(Servo, srvo_S1_C1_3, servo3, tServoNone) #pragma config(Servo, srvo_S1_C1_4, servo4, tServoNone) #pragma config(Servo, srvo_S1_C1_5, servo5, tServoNone) #pragma config(Servo, srvo_S1_C1_6, servo6, tServoNone) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "JoystickDriver.c"
void initializeRobot() { nxtDisplayCenteredTextLine(0, "1337 |-|@cker"); nxtDisplayCenteredTextLine(1, "TeleOp"); nxtDisplayCenteredTextLine(2, "by Neel Jha");
return; } void Slowmo() //drive train controls slowed down { while(joy1Btn(5)) { if(joystick.joy1_y1 > 5 || joystick.joy1_y1 < -5) { motor[leftm] = (joystick.joy1_y1/10); } else { motor[leftm] = 0; } if(joystick.joy1_y2 > 5 || joystick.joy1_y2 < -5) { motor[rightm] = (joystick.joy1_y2/10); } else { motor[rightm] = 0; } } } task main() { initializeRobot(); waitForStart(); // wait for start of tele-op phase
while(true) { getJoystickSettings(joystick); Slowmo(); // a call to Slowmo, so if Btn 5 is pressed this should hopefully take over drive train //standard drive train control if(joystick.joy1_y1 > 5 || joystick.joy1_y1 < -5) { motor[leftm] = joystick.joy1_y1; } else { motor[leftm] = 0; } if(joystick.joy1_y2 > 5 || joystick.joy1_y2 < -5) { motor[rightm] = joystick.joy1_y2; } else { motor[rightm] = 0; } } }
|  |  |  |  |
Is this even possible, or will the 2 conflicting sets of controls conflict with each other. I just thought of this and haven't tested it yet.
|
| Thu Mar 01, 2012 9:23 pm |
|
 |
|
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 528 Location: Totally not spying on Hassenplug to see what he has for the Brickworld Chicago 2013 sumo contest.
|
 Re: 1 Controller, 2 Control Schemes?
I don't see any problems with that. I think it should work fine.
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
| Thu Mar 01, 2012 9:27 pm |
|
 |
|
JhaneelJha
Rookie
Joined: Thu Mar 01, 2012 9:11 pm Posts: 6
|
 Re: 1 Controller, 2 Control Schemes?
I don't either I'm just afraid of testing it because of the two sets of opposing contols intefering with each other and possibly (worst case scenario burning out the motors).
|
| Thu Mar 01, 2012 9:30 pm |
|
 |
|
NeXT-Generation
Senior Roboticist
Joined: Wed Sep 28, 2011 10:13 pm Posts: 528 Location: Totally not spying on Hassenplug to see what he has for the Brickworld Chicago 2013 sumo contest.
|
 Re: 1 Controller, 2 Control Schemes?
There aren't really any "opposing" controls. It's just a condition that changes the motor speed when a button is pressed. The motors aren't gonna be receiving different commands. You should be just fine.
_________________A.K.A. inxt-generation Self-proclaimed genius, and future world dominator. My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth Doctor Bow down to Nikola Tesla, King of the Geek Gods.
|
| Thu Mar 01, 2012 9:34 pm |
|
 |
|
MHTS
Guru
Joined: Sun Nov 15, 2009 5:46 am Posts: 1023
|
 Re: 1 Controller, 2 Control Schemes?
Why don't you do something like this:  |  |  |  | Code: #pragma config(Hubs, S1, HTServo, HTMotor, HTMotor, HTMotor) #pragma config(Sensor, S1, , sensorI2CMuxController) #pragma config(Motor, mtr_S1_C2_1, liftr, tmotorNormal, openLoop) #pragma config(Motor, mtr_S1_C2_2, cnv, tmotorNormal, openLoop) #pragma config(Motor, mtr_S1_C3_1, liftl, tmotorNormal, openLoop) #pragma config(Motor, mtr_S1_C3_2, motorG, tmotorNone, openLoop) #pragma config(Motor, mtr_S1_C4_1, rightm, tmotorNormal, openLoop, reversed) #pragma config(Motor, mtr_S1_C4_2, leftm, tmotorNormal, openLoop, reversed) #pragma config(Servo, srvo_S1_C1_1, clamp, tServoStandard) #pragma config(Servo, srvo_S1_C1_2, servo2, tServoNone) #pragma config(Servo, srvo_S1_C1_3, servo3, tServoNone) #pragma config(Servo, srvo_S1_C1_4, servo4, tServoNone) #pragma config(Servo, srvo_S1_C1_5, servo5, tServoNone) #pragma config(Servo, srvo_S1_C1_6, servo6, tServoNone) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#include "JoystickDriver.c"
void initializeRobot() { nxtDisplayCenteredTextLine(0, "1337 |-|@cker"); nxtDisplayCenteredTextLine(1, "TeleOp"); nxtDisplayCenteredTextLine(2, "by Neel Jha");
return; } task main() { int scaleFactor; initializeRobot(); waitForStart(); // wait for start of tele-op phase
while(true) { getJoystickSettings(joystick); scaleFactor = joy1Btn(5)? 10: 1; if(joystick.joy1_y1 > 5 || joystick.joy1_y1 < -5) { motor[leftm] = joystick.joy1_y1/scaleFactor; } else { motor[leftm] = 0; } if(joystick.joy1_y2 > 5 || joystick.joy1_y2 < -5) { motor[rightm] = joystick.joy1_y2/scaleFactor; } else { motor[rightm] = 0; } } }
|  |  |  |  |
|
| Thu Mar 01, 2012 10:38 pm |
|
|
|
Page 1 of 1
|
[ 5 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 1 guest |
|
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
|
|