Combining RC and user motor control

I’m working on a project with Colorado State University to control the VEX robot using serial communications. I’m coding entirely in MPLAB with C18 and working from the default firmware. The serial communications part is going smoothly, but my problem is this.

In autonomous mode I can control the motors directly, but I receive no RC input whatsoever.

In non-autonomous mode I can receive RC input, but can only control the motors when the RC is turned on.

I’d like to get RC input and control the motors directly (as in pwm01 = 255; ), still having control of the robot if the RC is turned off.

My first thought was to switch between autonomous and non-autonomous depending on the rxdata.rc_receiver_status_byte, however, it doesn’t actually get sent in properly in autonomous mode (makes sense, otherwise someone could control thier robot in autonomous mode by turning the RC on and off.) So if there’s no input whatsoever to signify the RC turning on when in autonomous mode this switching won’t work.

I’m currently looking into using Generate_PWMs() and skipping the master processor, but the timing issues involved there worry me a little (I’d like a very stable platform), however, I may just be paranoid.

If anyone has any other ideas I’d appreciate any input. My current thoughts tell me it’s impossible to get any RC input in autonomous mode, but it would still seem reasonable that theres some way for the robot motors to run even when the RC is turned off in non-autonomous mode.

Thanks for any help you might be able to give.

You’re running into a built-in restriction in the control system that’s beyond our direct control.

A similar discussion that took place in the Vex subforums might help:

Thank you, I was afraid of that, but just wanted to get it confirmed. Generate_Pwms() seems to be sufficient, it just has a beeping sound from the motor. I appreciate the help.

So you were using the subroutine Generate_Pwms() to drive the motor outputs? For further clarification, does that allow you to drive the motors while the RC is off and the system is not in autonomous mode? Where do I find the Generate_Pwms() routine?

I posted the same question on the VEX forums. The people there had another solution using UserAPI.h out of the Easy C files. I’m not entirely clear about what they are doing, but it may be that they are simply switching between two different modes of control with the RC on the whole time.

Andy

It’s been a while now and I’m forgetful, but I believe the Generate_Pwms() function came with the default code (and was in the default libraries). I believe it does allow me to drive the motor when the system is not in autonomous mode and the RC is turned off.

When you say RC do you mean the transmitter?

Yes