View unanswered posts | View active topics It is currently Thu Apr 24, 2014 1:53 am






Reply to topic  [ 4 posts ] 
Question about transmitter 
Author Message
Rookie

Joined: Mon Sep 15, 2008 11:03 pm
Posts: 2
Post 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


Tue Sep 16, 2008 9:21 am
Profile
Rookie

Joined: Mon Sep 15, 2008 11:03 pm
Posts: 2
Post Re: Question about transmitter
Should I post my question somewhere else in the forum?

mc


Tue Sep 16, 2008 12:37 pm
Profile
Site Admin
Site Admin

Joined: Tue May 15, 2007 9:02 am
Posts: 403
Post 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
   }
}

_________________
Jesse Flot
CMU Robotics Academy
ROBOTC Support


Tue Sep 23, 2008 4:31 pm
Profile
Rookie

Joined: Sat Aug 30, 2008 2:25 am
Posts: 25
Post 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];
  }
}


Tue Sep 23, 2008 5:03 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 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

Search for:
Jump to:  



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