View unanswered posts | View active topics It is currently Wed Apr 25, 2018 12:25 pm

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

Joined: Thu Jan 30, 2014 9:28 am
Posts: 8
I am trying to program a toy jeep that is equipped with a Cortex, motors and GPS. I needed to make it so that the jeep will autonomously move to given coordinates, using the GPS which is connected through UART. The way I'm planning on doing this is by first making the jeep spin in a circle until it's facing north or south(depending on current coordinates and destination coordinates). Then, it will move straight until longitude matches the destination longitude and then continue with the latitude, the same way, until it finally reaches the destination.

Do I need to use multitasking since I need for the Cortex to refresh the coordinates from the gps and move the motors at the same time?

Wed Mar 05, 2014 9:11 am
Guru

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
If it's as simple as you described it, then no. You can easily do it like the following pseudo-code. Your logic will be more complex than this but you get the point.
 Code:// Spin to face north or south.while (readGPS() != north or south){    motor[left] = 50;    motor[right] = -50;    wait1Msec(100);}motor[left] = 0;motor[right] = 0;// Drive to target longitude.while (readGPS() is not reaching the longitude){    motor[left] = 100;    motor[right] = 100;    wait1Msec(100);}motor[left] = 0;motor[right] = 0;// Spin to face east or west.while (readGPS() != east or west){    motor[left] = 50;    motor[right] = -50;    wait1Msec(100);}motor[left] = 0;motor[right] = 0;// Drive to reach latitude.while (readGPS() is not reaching the lattude){    motor[left] = 100;    motor[right] = 100;    wait1Msec(100);}motor[left] = 0;motor[right] = 0;

Wed Mar 05, 2014 3:20 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