View unanswered posts | View active topics It is currently Thu Aug 21, 2014 11:58 pm






Reply to topic  [ 5 posts ] 
1 Controller, 2 Control Schemes? 
Author Message
Rookie

Joined: Thu Mar 01, 2012 9:11 pm
Posts: 6
Post 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
Profile
Senior Roboticist
User avatar

Joined: Wed Sep 28, 2011 10:13 pm
Posts: 630
Location: If I told you, I'd have to kill you.
Post 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
Profile WWW
Rookie

Joined: Thu Mar 01, 2012 9:11 pm
Posts: 6
Post 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
Profile
Senior Roboticist
User avatar

Joined: Wed Sep 28, 2011 10:13 pm
Posts: 630
Location: If I told you, I'd have to kill you.
Post Re: 1 Controller, 2 Control Schemes?
JhaneelJha wrote:
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).


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
Profile WWW
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post 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
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 2 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

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.