View unanswered posts | View active topics It is currently Tue Oct 21, 2014 4:48 am






Reply to topic  [ 5 posts ] 
nMotorEncoderTarget Issues 
Author Message
Rookie

Joined: Mon Feb 25, 2013 11:41 am
Posts: 7
Post nMotorEncoderTarget Issues
Hello fellow programmers! :D

In the nMotorEncoderTarget videos that are part of the RobotC curriculum, it says that the time (if "too much") should NOT effect the program that is running. It should stop at the target if the math is correct. Although we have confirmed that the mathematical part of the programming is correct, when we gave it extra time to make sure it ran the program fully, it still continued and passed the line. Why is the extra time effecting the outcome of the preset distance for the robot?

Thanks again!


Tue Jun 25, 2013 9:57 am
Profile
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 591
Post Re: nMotorEncoderTarget Issues
Hello,

Would you be able to post the code using the [code] tags? There may be another piece of code that is making the robot continue moving further than it is supposed to, but we'll need to see the code to determine if this is the case or not.

Thank you in advance!

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our Wiki and our Forums.

I just met you,
And this is crazy,
But here's my code now,
So fix it, maybe?
~ Carly Rae Jepsen parody


Tue Jun 25, 2013 10:14 am
Profile
Rookie

Joined: Mon Feb 25, 2013 11:41 am
Posts: 7
Post Re: nMotorEncoderTarget Issues
Thank you for your response! Here is an example of one of our student's programming. He followed all of the mathematical steps correctly and we double checked for him, yet he still went over the line. Lessening the time to the exact time needed would completely go against the entire purpose of this lesson.


Code:
task main()
{
   wait1Msec(1000);   //allow time to move hand away from orange button//

   nMotorEncoder[motorB]=0;         //clear encoder B//
   nMotorEncoder[motorC]=0;         //clear encoder C//

   nMotorEncoderTarget[motorB]=9356.4;    // distance in degrees to be calculated//
   nMotorEncoderTarget[motorC]=9356.4;    // distance in degrees to be calculated//

   motor[motorB]= 50;       //set motorB power//
   motor[motorC]= 50;       //set motorC power//
   wait1Msec(30000);        //set sufficient(or more) time to go distance//
}


Thanks for your help!


Tue Jun 25, 2013 10:38 am
Profile
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 591
Post Re: nMotorEncoderTarget Issues
StJamesSchool wrote:
Code:
task main()
{
   wait1Msec(1000);   //allow time to move hand away from orange button//

   nMotorEncoder[motorB]=0;         //clear encoder B//
   nMotorEncoder[motorC]=0;         //clear encoder C//

   nMotorEncoderTarget[motorB]=9356.4;    // distance in degrees to be calculated//
   nMotorEncoderTarget[motorC]=9356.4;    // distance in degrees to be calculated//

   motor[motorB]= 50;       //set motorB power//
   motor[motorC]= 50;       //set motorC power//
   wait1Msec(30000);        //set sufficient(or more) time to go distance//
}


The program looks solid and should work on a physical robot; the reason you are running into this issue is because the 'nMotorEncoderTarget' and 'nMotorSync' commands are unfortunately not supported in Robot Virtual Worlds at this time. However, the nMotorEncoder command is and can be used to control the robot's movement using encoders. For more information on this subject, please see this thread: viewtopic.php?f=55&t=5238&

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our Wiki and our Forums.

I just met you,
And this is crazy,
But here's my code now,
So fix it, maybe?
~ Carly Rae Jepsen parody


Tue Jun 25, 2013 12:19 pm
Profile
Rookie

Joined: Mon Feb 25, 2013 11:41 am
Posts: 7
Post Re: nMotorEncoderTarget Issues
Thanks again!


Wed Jun 26, 2013 9:49 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


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

Search for:
Jump to:  



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