View unanswered posts | View active topics It is currently Sun Apr 22, 2018 11:49 pm

 Page 1 of 1 [ 2 posts ]
 Print view Previous topic | Next topic
autonmous help
Author Message
Rookie

Joined: Sun Mar 06, 2011 6:53 pm
Posts: 7
autonmous help
we are haveing a slight problem with our autonmouse program. we are trying to move with dead reckoning by time.
here is what we tried

motor[motorD]=100;
motor[motorE]=100;
wait1Msec(2000);

next we tried this..
{
while (true);
{
ClearTimer(T1);

while(time1[T1]<2000)
{
motor[motorD]=100;
motor[motorE]=100;
}
while (time1[T1]>2000)
{
motor[motorD]=0;
motor[motorE]=0;
}
}
}

this worked so we added a turn and that worked it looked like this...

{
while (true);
{
ClearTimer(T1);

while(time1[T1]<2000)
{
motor[motorD]=100;
motor[motorE]=100;
}
while (time1[T1]>2000)
{
motor[motorD]=0;
motor[motorE]=0;
}
ClearTimer(T2);

while(time1[T2]<50)
{
motor[motorD]=100;
motor[motorE]=-100;
}
while(time1[T2}>50)
{
motor[motorD]=0;
motor[motorE]=0;
}
}
}

we then added a third movement, go straight, this didnt work what happend is that the program whent strait skiped over the turn and went straight again here is the code...
{
while (true);
{
ClearTimer(T1);

while(time1[T1]<2000)
{
motor[motorD]=100;
motor[motorE]=100;
}
while (time1[T1]>2000)
{
motor[motorD]=0;
motor[motorE]=0;
}
ClearTimer(T2);

while(time1[T2]<50)
{
motor[motorD]=100;
motor[motorE]=-100;
}
while(time1[T2}>50)
{
motor[motorD]=0;
motor[motorE]=0;
}

Cleattimer(T3);

while(time1[T3]<2000)
{
motor[motorD]=100;
motor[motorE]=100;
}

while(time1[T3]>2000)
{
motor[motorD]=0;
motor[motorE]=0;
}
}
}

Any help would be appreciated. THANKS

Mon Mar 07, 2011 3:51 pm
Rookie

Joined: Mon Mar 07, 2011 5:45 pm
Posts: 6
Re: autonmous help
 Code:while (time1[T1]>2000){motor[motorD]=0;motor[motorE]=0;}

Your robot is stuck in a while loop while the time is more than 2000. Since the timer counts up, it will never go back under 2000. You won't ever get out of the while loop, so the next code should never start.

It would be more efficient to use Motor Encoders, simply because powers vary with how much the battery is charged. You won't move a constant distance each time.

If you do insist on using timers, then choose a different condition.
Try using time1[T1] < someTime. This will give you the set amount of time of movement (or lack of movement) you want.

Mon Mar 07, 2011 5:55 pm
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