View unanswered posts | View active topics It is currently Mon Sep 21, 2020 3:42 pm

Reply to topic  [ 2 posts ] 
More user friendly omni drive program help 
Author Message

Joined: Fri Nov 06, 2009 12:33 pm
Posts: 1
Post More user friendly omni drive program help
Hey everyone, I am currently programming an omni directional drive system(any direction drive system, one wheel on each side), well I have done the original program, but I want to improve the program so it is more "user friendly". When I say user friendly I mean that I want the direction of the robot not to be depended on the exactiveness of the human controlling the robot. So my plan is to split the parts of the control stick direction into several "pie sections".

The way I would like to do this is by using mathmatical functions like y = x, and y = -x. With these functions, the "pie" is split up in to four sections, up, down, left, and right. The point of me doing this is that if the control stick is put anywhere near the up "pie section", the x value is gonna be forced to stay as the value of 0, and y value is allowed to change freely. So far I have:

// left stick x = vexRT(Ch4)
// left stick y = vexRT(Ch3)
// right stick y = vexRT(Ch2)
// right stick x = vexRT(Ch1)
if((vexRT(Ch3) > 0) && ((vexRT(Ch4) == -(vexRT(Ch3)/2) < vexRT(Ch4) < (vexRT(Ch4) = vexRT(Ch3)/2))); //This is the spot where I am having the problem. Also with this function I am trying to say if the value of y is greater than 0, and if the value of x is inbetween y = -x and y = x then y can change and x has to be a constant of 0
vexRT(Ch4) == 0;
motor[m1] == (vexRT(Ch3)) + (-1 * vexRT(Ch4)) + (-1 * vexRT(Ch2));
motor[m2] == (-1 vexRT(Ch3)) + (-1 * vexRT(Ch4)) + (-1 * vexRT(Ch2));
motor[m3] == (-1 * vexRT(Ch3)) + (vexRT(Ch4)) + (-1 * vexRT(Ch2));
motor[m4] == (vexRT(Ch3)) + (vexRT(Ch4)) + (-1 * vexRT(Ch2));

Any comments on the program are welcome, cause It is in early development.

Fri Nov 06, 2009 1:02 pm

Joined: Sat Nov 22, 2008 8:06 pm
Posts: 48
Post Re: More user friendly omni drive program help
Use the absolute value of x and y to decide which is greater, then only read from that axis. I'm pretty sure RobotC has an abs() function, if not you can make one.

if(abs(x) > abs(y))
//drive motors left or right on x axis.
if(abs(y) > abs(x))
//drive motors forward or backward on y axis.
if(abs(y) == abs(x))
//If you wanted to make the code more complex, you could use this.

Should work once you get the motor code into it.

Omnibots are a lot of fun.

Tue Nov 24, 2009 1:58 am
Display posts from previous:  Sort by  
Reply to topic   [ 2 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.