View unanswered posts | View active topics It is currently Fri Aug 29, 2014 10:30 pm






Reply to topic  [ 5 posts ] 
How to control RobotC with 2 controllers 
Author Message
Rookie

Joined: Mon Oct 05, 2009 10:31 pm
Posts: 2
Post How to control RobotC with 2 controllers
Hello, I have struggled to figure out how to use robotC with two controllers, I have searched through the documentation and found nothing, I was curious if anyone here knew how to do it. Thanks. This is my code currently.
Code:
task main()
{


   bVexAutonomousMode = false;

   while (true)
   {

   int right_motor1;
   int   right_motor2Fliped;
   int   left_motor1;
   int   left_motor2Fliped;
   int   lift1;
   int lift2;
   int   intake_left;
   int   intake_right;
   motor[port1] = right_motor1;
   motor[port2] = right_motor2Fliped;
   motor[port3] = left_motor1;
   motor[port4] = left_motor2Fliped;
   motor[port5] = lift1;
   motor[port6] = lift2;
   motor[port7] = intake_left;
   motor[port8] = intake_right;

  right_motor1 = vexRT[Ch2];
  right_motor2Fliped = vexRT[Ch2]*-1;
   left_motor1 = vexRT[Ch3];
  left_motor2Fliped = vexRT[Ch3]*-1;
  lift1 = vexRT[Ch6];
  lift2 = vexRT[Ch6];
  intake_left = vexRT[Ch5];
  intake_right = vexRT[Ch5];
  }


}


Mon Oct 05, 2009 11:18 pm
Profile
Site Admin
Site Admin

Joined: Wed Jan 24, 2007 10:42 am
Posts: 602
Post Re: How to control ROBOTC with 2 controllers
Hi,

Yes, the documentation seems to be lacking this information. Here's how you can do it:

Code:
vexRT[Ch1];
vexRT[Ch2];
vexRT[Ch3];
vexRT[Ch4];
vexRT[Ch5];
vexRT[Ch6];

vexRT[Ch1Xmtr2];
vexRT[Ch2Xmtr2];
vexRT[Ch3Xmtr2];
vexRT[Ch4Xmtr2];
vexRT[Ch5Xmtr2];
vexRT[Ch6Xmtr2];


Hope this helps. Thanks.

_________________
Timothy Friez
ROBOTC Developer - SW Engineer
tfriez@robotc.net


Fri Oct 09, 2009 12:39 pm
Profile
Site Admin
Site Admin

Joined: Tue May 15, 2007 9:02 am
Posts: 405
Post Re: How to control ROBOTC with 2 controllers
Here's a little more code that might help:

Code:
task main()
{
  while(true);
  {
    motor[port2] = vexRT[Ch2];        //Set motor port 2 equal to Transmitter 1 Channel 2
    motor[port3] = vexRT[Ch3Xmtr2];   //Set motor port 3 equal to Transmitter 2 Channel 3
  }
}

_________________
Jesse Flot
CMU Robotics Academy
ROBOTC Support


Thu Oct 22, 2009 11:46 am
Profile
Rookie

Joined: Thu Nov 18, 2010 2:38 pm
Posts: 1
Post Re: How to control RobotC with 2 controllers
is the code that i have correct to drive with two transmitters?

Code:
task main()
{


bVexAutonomousMode = false;

while (true)
{

int right_motor1;
int right_motor2Fliped;
int left_motor1;
int left_motor2Fliped;
int lift1;
int lift2;
motor[port1] = right_motor1;
motor[port2] = right_motor2Fliped;
motor[port3] = left_motor1;
motor[port4] = left_motor2Fliped;
motor[port5] = lift1;
motor[port6] = lift2;
motor[port7];
motor[port8];

right_motor1 = vexRT[Ch2];
right_motor2Fliped = vexRT[Ch2]*-1;
left_motor1 = vexRT[Ch3];
left_motor2Fliped = vexRT[Ch3]*-1;
lift1 = vexRT[Ch2Xmtr2];
lift2 = vexRT[Ch3Xmtr2];
}


}


Thu Nov 18, 2010 2:45 pm
Profile
Site Admin
Site Admin

Joined: Tue May 15, 2007 9:02 am
Posts: 405
Post Re: How to control RobotC with 2 controllers
In your code, you created a set of variables, then set your motors equal to those variables, but nothing is stored in them the first time the loop runs. Why not set the motors you want to use directly equal to the remote control values (vexRT commands), like this sample code:

Code:
task main()
{
  while(true);
  {
    motor[port2] = vexRT[Ch2];        //Set motor port 2 equal to Transmitter 1 Channel 2
    motor[port3] = vexRT[Ch3Xmtr2];   //Set motor port 3 equal to Transmitter 2 Channel 3
  }
}


Your program accesses values from both remote control 1 and remote control 2. Any of the channel numbers that use "Xmtr2" refer to remote control 2.

_________________
Jesse Flot
CMU Robotics Academy
ROBOTC Support


Thu Nov 18, 2010 2:53 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.