View unanswered posts | View active topics It is currently Sat Apr 04, 2020 10:15 am

 Page 1 of 1 [ 2 posts ]
 Print view Previous topic | Next topic
More user friendly omni drive program help
Author Message
Rookie

Joined: Fri Nov 06, 2009 12:33 pm
Posts: 1
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
Rookie

Joined: Sat Nov 22, 2008 8:06 pm
Posts: 48
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
 Page 1 of 1 [ 2 posts ]

#### Who is online

Users browsing this forum: No registered users and 2 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ ROBOTC Applications    ROBOTC for LEGO MINDSTORMS       Third-party sensors    ROBOTC for CORTEX & PIC    ROBOTC for VEX IQ    ROBOTC for Arduino    Robot Virtual Worlds    Multi-Robot Communications    Issues and Bugs Competitions & Partners    Mini Urban Challenge    CS2N Robot Virtual Worlds Competitions       VEX Skyrise Competition 2014-2015       VEX Toss Up 2013-2014       FTC Block Party! 2013-2014    Competitions using VEX - BEST, TSA, VEX, and RoboFest!    FTC Programming    RoboCup Junior and Other ROBOT Competitions Virtual Brick Robotics Discussions    General Discussions    Project Discussions Off-Topic ROBOTC Forum & ROBOTC.net Suggestions/Feedback    ROBOTC Forums Suggestions/Comments    ROBOTC.net Suggestions/Comments       NXT Programming: Tips for Beginning with ROBOTC       VEX Programming: Tips for Beginning with ROBOTC    2013 Robotics Summer Of Learning       VEX Toss Up Programming Challenge       FTC Ring It Up! Programming Challenge    International Forums       Spanish Forums          ROBOTC for MINDSTORMS          ROBOTC for VEX       French Forums          ROBOTC pour Mindstorms          ROBOTC pour IFI VEX       Japanese Forums （日本語のフォーラム）       German Forums    2015 Spring Carnival Event    PLTW (Project Lead The Way)    Robotics Merit Badge    2014 Robotics Academy Summer of Learning