View unanswered posts | View active topics It is currently Sat Aug 18, 2018 4:01 am

 Page 1 of 1 [ 2 posts ]
 Print view Previous topic | Next topic
Turning in a defined degree
Author Message
Rookie

Joined: Tue Oct 04, 2011 6:22 am
Posts: 7
Turning in a defined degree
Hi again,

after my first steps I would like to reach that my robot (I still reached that the robot stop about 20 cm before it reach a wall, even I noticed a blanket does not work), go backwards (no problem) and turn than so long that he reach a 90 degree position from its last.

I read a bit about that it is not so easy to do that because the timer and so on don't work perfect. Is there a explaination how you can calculate with timer so for example it will turn 90 degrees?

Thanks and regards

Stefan

Sun Aug 12, 2012 9:14 am

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Re: Turning in a defined degree
You should take a look at nMotorEncoderTarget. Search for that keyword in the help and you'll find this little snippet:

 Code:nMotorEncoder[motorB] = 0;                // Reset the Motor Encoder of Motor B.nMotorEncoderTarget[motorB] = 360;        // Set the  target for Motor Encoder of Motor B to 360.motor[motorB] = 75;                       // Motor B is run at a power level of 75.motor[motorC] = 75;                       // Motor C is run at a power level of 75.while(nMotorRunState[motorB] != runStateIdle)  // While Motor B is still running:{  // Do not continue.}motor[motorB] = 0;                       // Motor B is stopped at a power level of 0.motor[motorC] = 0;

Now you need to calculate how many degrees your motors needs to turn in order turn the robot 90 degrees. I'll leave as an exercise for the reader

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]

Sun Aug 12, 2012 9:30 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