ROBOTC.net forums
http://www.robotc.net/forums/

Question about transmitter
http://www.robotc.net/forums/viewtopic.php?f=11&t=724
Page 1 of 1

Author:  molly [ Tue Sep 16, 2008 9:21 am ]
Post subject:  Question about transmitter

I am fairly new to robotics and very new to Vex and a controller. My class has built Squarebot 2.0 and we are now starting to program. In my program I have port 2 and 3 correspond to two motors that run the wheels, and with the controller channels 2 and 3 correspond to the same motors. I have a group that would like to have 1 channel on the controller to move both motors forward, so they do not have to use the both on the joystick to move the robot forward (moving right/left) at the same time.

My thoughts were this: could we rebuild the robot so the forward and reverse is connected to one channel on the joystick? Or could we somehow reset the transmitter to accomplish this, or finally is there a way to do this programmatically? I then wonder how would we address turning the robot.

Any help would be appreciated.

thanks

Molly

Author:  molly [ Tue Sep 16, 2008 12:37 pm ]
Post subject:  Re: Question about transmitter

Should I post my question somewhere else in the forum?

mc

Author:  jbflot [ Tue Sep 23, 2008 4:31 pm ]
Post subject:  Re: Question about transmitter

Molly -

Are you using ROBOTC? If you are, there is no rule that the motors on ports 2 and 3 can't be controlled by the same joystick.

Here's a sample program which should allow you to steer your robot with just one joystick (but both channels on it).

Code:
task main()
{
   bMotorFlippedMode[port2] = 1;    //Port 2 Motor Direction Flipped
   bVexAutonomousMode = false;   //Activates Remote Control Mode

   while (true)   //Creates an infinite loop
   {
      motor[port2] = vexRT[Ch3]/2 - vexRT[Ch4]/2;      //y-axis value: forward/backward motion
      motor[port3] = vexRT[Ch3]/2 + vexRT[Ch4]/2;      //x-axis value: left/right steering
                                 //divided by 2 to prevent values over 127
   }
}

Author:  fryfrog [ Tue Sep 23, 2008 5:03 pm ]
Post subject:  Re: Question about transmitter

You can even go as far as removing the "/2" that halves the inputs, that way you don't lose half of your speed. I use something like the below which has 4 motors, pairs on port1/7 and port 2/8.

Like they say above, with RobotC you can put the motors on any port you want and use the sticks/buttons for anything you want as well. This is a bit from a simple program I use to control tank treads with the left stick and a camera on a turret (up/down/left/right) with the right stick. I've removed the turret junk though.

Don't forget you may or may not need the "bMotorFlippedMode" and you may or may not need it on the *other* ports instead.

Code:
#pragma config(Motor,    port1,                  leftMotor1,                  tmotorNormal)
#pragma config(Motor,    port2,                  rightMotor1,               tmotorNormal)
#pragma config(Motor,    port7,                  leftMotor2,                  tmotorNormal)
#pragma config(Motor,    port8,                  rightMotor2,               tmotorNormal)
//*!!Code automatically generated by 'ROBOTC' configuration wizard                      !!*//

task main()
{
  bMotorFlippedMode[leftMotor1] = 1;
  bMotorFlippedMode[leftMotor2] = 1;

  bVexAutonomousMode = false;

  while(true)
  {
        // Mixing ch3 and ch4 to control tank with 1 stick.
        motor[leftMotor1] = vexRT[Ch3] + vexRT[Ch4];
        motor[rightMotor1] = vexRT[Ch3] - vexRT[Ch4];
        motor[leftMotor2] = vexRT[Ch3] + vexRT[Ch4];
        motor[rightMotor2] = vexRT[Ch3] - vexRT[Ch4];
  }
}

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/