View unanswered posts | View active topics It is currently Wed Apr 23, 2014 3:27 am






Reply to topic  [ 4 posts ] 
Palm Island Inconsistency 
Author Message
Rookie

Joined: Tue Jul 23, 2013 10:04 am
Posts: 2
Post Palm Island Inconsistency
I am working on the CS2N Summer of learning Lego Mindstorms NXT Course. I have currently encountered some
problems with Palm Island Lauau Edition, in which my robot will sometimes go straight, or sometimes go to far to the left or to far to the right, even though I am running the same piece of code. Here is the code so whoever looks at this might be able to see something wrong.
Thanks,
Enderplatypus


Attachments:
File comment: My code
Palm Island.c [1.4 KiB]
Downloaded 161 times
Tue Jul 23, 2013 10:21 am
Profile
Moderator
Moderator

Joined: Mon Oct 04, 2010 2:18 pm
Posts: 117
Post Re: Palm Island Inconsistency
Hi,

I used the code tags to post your code below:

Code:
#pragma config(Sensor, S1,     touchSensor,              sensorTouch)
#pragma config(Sensor, S2,     compassSensor,            sensorVirtualCompass)
#pragma config(Sensor, S3,     lightSensor,              sensorLightActive)
#pragma config(Sensor, S4,     sonarSensor,              sensorSONAR)
#pragma config(Motor,  motorA,          gripperMotor,       tmotorNormal, PIDControl, encoder)
#pragma config(Motor,  motorB,          rightMotor,         tmotorNormal, PIDControl, encoder)
#pragma config(Motor,  motorC,          leftMotor,          tmotorNormal, PIDControl, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//
// This is for the NXT model, not TETRIX

/************************************\
|*  ROBOTC Virtual World            *|
|*                                  *|
|*  DO NOT OVERWRITE THIS FILE      *|
|*  MAKE SURE TO "SAVE AS" INSTEAD  *|
\************************************/

task main()
{

motor[motorB] = 50;
motor[motorC] = 50;

wait10Msec(360);

motor[motorB] = 50;
motor[motorC] = -50;
wait1Msec(970);

motor[motorB] = 50;
motor[motorC] = 50;

wait1Msec(4000);

motor[motorB] = -50;
motor[motorC] = 50;
wait1Msec(960);

motor[motorB] = 50;
motor[motorC] = 50;

wait1Msec(9000);


motor[motorB] = 50;
motor[motorC] = -50;
wait1Msec(970);


//motor[motorB] = 50;
//motor[motorC] = 50;
//wait10Msec(900);
}


Remember, your robot is only going to do what you tell it to do. Let's take a look at what you are telling your robot to do. First, you have the robot moving forward at 50 percent power for a time. Then, without slowing down, you have the robot turn. Think about what would happen if you attempted to do that with a car. Drive the car at a certain speed and then, without slowing down, turn. The same physics that would cause the car to make an unreliable turn cause the virtual robot in palm island to also make an unreliable turn.

In cars, we hit the brakes and slow it down before we make a turn. With robots, the easiest thing to do is to have the robot stop before it makes another movement. So, we would have the robot move forward, stop, and then turn.

Try having your robot stop in between movements and see if that helps.


Tue Jul 23, 2013 1:27 pm
Profile
Rookie

Joined: Tue Jul 23, 2013 10:04 am
Posts: 2
Post Re: Palm Island Inconsistency
Thank You,
That definitely sounds like the problem.


Tue Jul 23, 2013 1:32 pm
Profile
Moderator
Moderator

Joined: Mon Oct 04, 2010 2:18 pm
Posts: 117
Post Re: Palm Island Inconsistency
You're welcome. Please don't hesitate to ask if you have any other questions as you work through the class.


Tue Jul 23, 2013 5:57 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


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.