Two Controller Robots.

For my robotics class we are using 3 kits to build a decathlon robot. i have the design planned out and am very pleased with it. my plan has always included using two controllers, 1 for drive and shifting from high gear to low gear and vice versa, and the other controller to control the extra accessories on the robot like the shooter and gatherer. i understand that you put in two receivers with different crystals and use the coordination controllers but how do you isolate which motor ports are controlled by each controller? we do have a prog kit but we are very inexperienced and simpler would be better for us (simpler is almost always better).

thanks a million guys

You have the right idea, but I don’t think you will be able to do this without at least writing a simple program. This is pretty straightforward in EasyC.

Do you know what mapping you have in mind?
Something like:
[INDENT]Motor1 = Rx1 ch1
Motor2 = Rx1 ch2
Motor3 = Rx1 ch3
Motor4 = Rx1 ch4
Motor5 = Rx2 ch1
Motor6 = Rx2 ch2
Motor7 = Rx2 ch3
Motor8 = Rx2 ch4
Or did you need some mapping that used the back buttons?

Quazar is right you will need to write a program, but it will be very simple especially if you have EasyC.

EasyC has a block which allows you to control a motor with the radio transmitter. The block has drop down menus that allow you to select the transmitter (1 or 2), the channel (1-6), and port(1-8) the motor is plugged into. All you have to do is put the blocks inside of an infinite loop and you will be good to go. There is even a block for the drive motors where you can control 4 motors in “Tank” or “Arcade” mode. EasyC is very simple and easy to use, but as you learn more you can still do advanced programming with it.

Thanks Guys.

now would it be possible to make it so say 3 motors could all be controlled by 1 stick. our design for a shooter for is 3 motors spinning a hammer thing at a ratio of 1 to 25. we do not have y cables so could i make it so ports 5-6-7 all are controlled by the right stick on the second controller? Or would i have to make it so 5 and 6 are controlled by left stick and 7 is controlled by right stick? Yes we were hoping to use the back buttons for shifting.

right now as i see it we want something like this.

Controller 1 is for drive and shifting

arcade drive (right stick) in motor ports 1 and 2
shifting in motor port 3 controlled by the back buttons on the left (channel 5?)

Controller 2 is for accessories

right stick controllers ports 4 5 and 6
back left buttons control port 7
back right buttons control port 8

would this work or is this a little too ambitious. i am willing to put in many hours and get this working if needed.

The default code shipped with the robot can use two transmitters. See Control Configuration – Appendix D of your inventors guide. The last six pages covers the dual transmitter option.

The mappings don’t cover exactly the way you have broken it out, but come very close. It may be an option to use the default code while your programming team gets up to speed.

The inventor’s guide is a wonderful book, well worth the two hours it will take to read and understand it.

thanks foster i had looked at that before and it seemed too far off to be useful. i am currently leaning towards just programming it myself it seems pretty easy. just to clarify we are not really a team we are a three member group and i am the only member who really cares so i am our builder, designer, programmer and all of the other ----ers.

In RobotC, what you want would be ~8 lines of actual code I think.

And yes, you can easily control 3 ports with one stick (or button).

Even the default program does this, mapping ports 1 and 7 together and 2 and 8 (hopefully I got the pairing right, it is easy to figure out at least).

#pragma config(Motor,	 port1,						Motor1,						tmotorNormal)
#pragma config(Motor,	 port2,						Motor2, 					tmotorNormal)
#pragma config(Motor,	 port3,						Motor3,  					tmotorNormal)
#pragma config(Motor,	 port4,						Motor4,	    			tmotorNormal)
#pragma config(Motor,	 port4,						Motor5,	    			tmotorNormal)
#pragma config(Motor,	 port4,						Motor6,	    			tmotorNormal)
#pragma config(Motor,	 port7,						Motor7,						tmotorNormal)
#pragma config(Motor,	 port8,						Motor8, 					tmotorNormal)
//*!!Code automatically generated by 'ROBOTC' configuration wizard							 !!*//

task main()
	// Maybe you'd need this?
  bMotorFlippedMode[Motor1] = 1;
  bMotorFlippedMode[Motor2] = 1;

  bVexAutonomousMode = false;

        // Drive motors, perhaps
        motor[Motor1] = vexRT[Ch3];
        motor[Motor2] = vexRT[Ch3];
        motor[Motor3] = vexRT[Ch1];
        motor[Motor4] = vexRT[Ch1];

        // Some other motors.
        motor[Motor5] = vexRT[Ch1Xmtr2];
        motor[Motor6] = vexRT[Ch1Xmtr2];
        motor[Motor7] = vexRT[Ch1Xmtr2];
        motor[Motor8] = vexRT[Ch2Xmtr2];

I think something like the above would work, but I haven’t tested it (it does compile, at least). If you aren’t using 2 motors for each side’s drive, then you could of course re-map those motors to something else (shifting, you said?)

I actually prefer the following for controlling a tank robot with 1 stick, it makes things much nicer.

        motor[leftMotor1] = vexRT[Ch3] + vexRT[Ch4];
        motor[rightMotor1] = vexRT[Ch3] - vexRT[Ch4];
        motor[leftMotor2] = vexRT[Ch3] + vexRT[Ch4];
        motor[rightMotor2] = vexRT[Ch3] - vexRT[Ch4];

The programming is easy, I was under the impression that the progrogramming skills were very low. Our team uses the WPI Library for Vex with MPLabs compiler. All the interface calls have a parameter to specifiy which transmitter and then channel in that transmitter. In your example you would use the Arcade interface for the two drive wheels and the OIToPWM calls for the other motors.

You can make multiple calls to send the values to multiple motors, that would allow your triple up on your motors. In additon there is an invert parameter that would allow you to tie together motors that are “facing” different ways.

#define Trans_1 1
#define Trans_2 2
#define Chan_1 1
#define Chan_2 2 
#define Motor_1 1
#define Motor_2 2
#define Motor_3 3
#define Motor_4 4
#define Motor_5 5
#define Motor_6 6
//Motor inversion
#define No_Invert 0
#define Invert 1

Arcade2(Trans_1, Chan_1, Chan_2, Motor_1, Motor_2,No_Invert,No_Invert);
OIToPWM(Trans_1, Chan_5, Motor_3, No_Invert);

OIToPWM(Trans_2, Chan_2, Motor_4, No_Invert);
OIToPWM(Trans_2, Chan_2, Motor_5, Invert); // motor is turned the other way on the robot
OIToPWM(Trans_2, Chan_2, Motor_6, No_Invert);
// need rest of the Transmitter 2 code .....

In EasyC you can do the same thing, just drag the interfaces over to the code block. RobotC has a similar setup. (And I’m sure others will post that sample code)

Good luck!

thanks fryfrog the only question that i have now is can i choose the direction that the motor spins in easily? i know that there is a way to do this on the controller but i never learned how and i just looked through the guide and didn’t find it. what is the easiest way?

i wrote this before i saw foster’s post but we (I) are going to use easy c

The line…

bMotorFlippedMode[Motor1] = 1;

is what flips the way the motor rotates. I’m sure that EasyC has the same thing, maybe someone who uses it will post about it. I can’t imagine it is hard to find. I wouldn’t bother with the transmitter for doing this (in theory, it can reverse servos), since you are already going to do some programming you may as well throw in that one EasyC block or that one line of RobotC.

Before you actually join a pair of motors on the same drive train, run them unconnected and make sure they are spinning how you expect :slight_smile:

The easiest way is to flip the channel on the controller. Instructions for this are here, starting on page E-4.

This won’t help you if you want to run two motors in opposite directions, both controlled by a single channel. If you need to do that, then you’ll have to do that in software. The math is easy, though.

In EasyC and MPLAB, you’d do something like this:

Motor1Speed = (whatever you want it to be);
Motor2Speed = 255 - Motor1Speed; // Sets Motor2 to the reverse of Motor1


  • Dean

thanks guys i am confident i can figure this out. if there is anything else you think would be useful for me to know then post it but i am more than satisfied with what i have learned. :slight_smile: