View unanswered posts | View active topics It is currently Mon Jun 18, 2018 7:12 am

 Page 1 of 1 [ 7 posts ]
 Print view Previous topic | Next topic
Basic Questions
Author Message
Rookie

Joined: Mon Feb 25, 2013 11:41 am
Posts: 7
Basic Questions
Hi, we are St. James School in Highwood, IL and we are new to RobotC Mindstorms. We have lots of questions and hope you guys can help us along.

First Question: Is it necessary to sync the motors prior to each command?

Second Question: Is it necessary to do the nMotorEncoder procedure before each command?

More questions to follow.
Sorry for being such newbies, but it's all new to us.

Mon Feb 25, 2013 11:50 am
Rookie

Joined: Tue Feb 19, 2013 4:11 pm
Posts: 8
Re: Basic Questions
To answer your questions:

1. No, syncing the motors only needs to be done once. The statement will need to be before you make any commands.

2. Not sure exactly what you want as an answer for this one... The nMotorEncoder[motor] statement is used to retrieve the encoder value from a particular motor (with encoder equipped).
For the NXT motors, encoder values are calculated in degrees of rotation (360 per rotation) and Tetrix encoders are calculated in quarter-degrees of rotation (1440 per rotation). These values are useful for determining distance travelled.

Hope this helps,

Team 5009

Mon Feb 25, 2013 2:16 pm
Moderator

Joined: Thu Jan 03, 2013 5:10 pm
Posts: 207
Location: The plateau north of the Ohio River Valley, also known as Cave Country.
Re: Basic Questions
More info: Synching motors is not useful for every robot configuration. only use it when you want a motor to always travel at a speed related to the speed of another motor. On question 2, nMotorEncoder is not a procedure. It is a 3-value array holding the values of each motor's internal encoder. Please note the difference between procedures and variables. Anyway, there are two things you can do with this variable: read it and reset it. You seem to be interested in reseting it. To do that, you would write zero to it, like: nMotorEncoder[motorB] = 0 . You do not have to do this before every motor command, either; however, you might want to. If the nature of the command is to set the power, reseting has no effect on it. if you are going to set an encoder target, you may or may not want to reset it. It all depends on How you want your robot to behave.

Also, don't be sorry about being newbies. We all were at one time and we are here to help!

I hope this helps!

-Coder A

_________________
I'm not a robot! I'm british! ~ quote from an asparagus
I am not a robot! I am a unicorn! ~ quote from a robot

Mon Feb 25, 2013 2:45 pm
Rookie

Joined: Mon Feb 25, 2013 11:41 am
Posts: 7
Re: Basic Questions
Thanks to both of you for responding.

Robo5009: So when you say the syncing only needs to be done once, do you mean once per program or if I sync the motors for a given program, and I change the program, do I need to re-sync?

Coder A: Shouldn't we use the nmotorencoderTarget procedure for each distance calculation?

I guess our primary concern is making the robot travel in a straight line.

And again, I apologize for such simple questions, but as you see, we have a lot to learn.

Mon Feb 25, 2013 3:41 pm
Moderator

Joined: Mon Oct 04, 2010 2:18 pm
Posts: 196
Re: Basic Questions
Hey, have you checked out the ROBOTC for Lego Mindstorms curriculum:

http://www.education.rec.ri.cmu.edu/pre ... index.html

If you are just beginning, it's a great place to start. I've been using it in my classroom for a few years now. Don't worry about asking basic questions. The forum is a great place to ask those questions.

Mon Feb 25, 2013 8:19 pm
Rookie

Joined: Mon Feb 25, 2013 11:41 am
Posts: 7
Re: Basic Questions
 parkway wrote:Hey, have you checked out the ROBOTC for Lego Mindstorms curriculum: http://www.education.rec.ri.cmu.edu/pre ... index.htmlIf you are just beginning, it's a great place to start. I've been using it in my classroom for a few years now. Don't worry about asking basic questions. The forum is a great place to ask those questions.

Hi Parkway, Yes, I use the cirriculum regularly, but some things are not entirely clear to us.

Tue Feb 26, 2013 9:28 am
Moderator

Joined: Thu Jan 03, 2013 5:10 pm
Posts: 207
Location: The plateau north of the Ohio River Valley, also known as Cave Country.
Re: Basic Questions
If your main idea is to move the robot in a straight line, you will want to synch the motors. As for synching carrying over to other programs, I've never even thought about it. I would guess not, but I really don't know. Until you find out, it would be good just to synch at the beginning of every program that needs synching.

As for the target question, the best way to explain its use is with an example: Let's say you have a robot that travels in a straight line, using the synch program. It has already moved forward 40 degrees from the start position. If you want it to move forward 600 more degrees, there are two ways of doing it, shown below.

Way 1:

1. Reset the encoder.----------------nMotorEncoder[motorB] = 0;
2. Set the target.--------------------nMotorEncoderTarget[motorB] = 600;
3. Set the power.--------------------motor[motorB] = 75;

Way 2:

1. Set a new encoder target.---------nMotorEncoderTarget[motorB] = nMotorEncoder[motorB] + 600;
2. Set the power.----------------------motor[motorB] = 75;

The difference is that at the end of the code sequence, way 1's encoder says 600 and way 2's encoder says 640 (600 just moved plus the 40 already moved). Way 2 saves the encoder information, but way 1 overwrites it.

_________________
I'm not a robot! I'm british! ~ quote from an asparagus
I am not a robot! I am a unicorn! ~ quote from a robot

Last bumped by StJamesSchool on Thu Apr 04, 2013 10:33 am.

Thu Apr 04, 2013 10:33 am
Display posts from previous:  Sort by
 Page 1 of 1 [ 7 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

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.