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






Reply to topic  [ 7 posts ] 
Labryinth 
Author Message
Rookie

Joined: Sun Jul 07, 2013 11:48 am
Posts: 11
Post Labryinth
Hi again. When I do my code
Code:
task main()
{
   motor[motorC] = 100;
   motor[motorB] = 100;
   wait1Msec(5000);


   motor[motorC] = -100;
   motor[motorB] = 0;
   wait1Msec(800);

   motor[motorC] = 100;
   motor[motorB] = 100;
   wait1Msec(5000);

   motor[motorC] = -100;
   motor[motorB] = 0;
   wait1Msec(800);

   motor[motorC] = 100;
   motor[motorB] = 100;
   wait1Msec(2000);

   motor[motorC] = -100;
   motor[motorB] = 0;
   wait1Msec(800);

   motor[motorC] = 100;
   motor[motorB] = 100;
   wait1Msec(2000);
}
It goes forward but does not turn. I also tried
Code:
task main()
{
   motor[motorC] = 100;
   motor[motorB] = 100;
   wait1Msec(5000);


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

   motor[motorC] = 100;
   motor[motorB] = 100;
   wait1Msec(5000);

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

   motor[motorC] = 100;
   motor[motorB] = 100;
   wait1Msec(2000);

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

   motor[motorC] = 100;
   motor[motorB] = 100;
   wait1Msec(2000);
}
But it still doesn't turn. What do I do/change?


Sun Jul 07, 2013 9:09 pm
Profile
Site Admin
Site Admin
User avatar

Joined: Tue Oct 09, 2012 10:34 am
Posts: 192
Post Re: Labryinth
Hmm, the turning is working for me, so I'm not sure what the problem might be. If you select View>>Preferences>>Highlight Program Execution, it will show you how your program is executing. Does this give you any hints?

Best,
--Ryan

_________________
Ryan Cahoon
CMU Robotics Academy
RVW Software Developer

Robot Potato Head; Virtual NXT


Sun Jul 07, 2013 10:39 pm
Profile
Rookie

Joined: Sun Jul 07, 2013 11:48 am
Posts: 11
Post Re: Labryinth
rcahoon wrote:
Hmm, the turning is working for me, so I'm not sure what the problem might be. If you select View>>Preferences>>Highlight Program Execution, it will show you how your program is executing. Does this give you any hints?

Best,
--Ryan

No..


Thu Jul 11, 2013 8:07 pm
Profile
Moderator
Moderator

Joined: Mon Oct 04, 2010 2:18 pm
Posts: 196
Post Re: Labryinth
Try breaking down your code some more. I always try to test one or two movements at a time. I pasted your code below, but I commented out everything after the first turn. Try running that code and see what your robot does.

Also, to Ryan's point about highlighting program executing, you can also try stepping through your code to see what your program is doing at certain points: http://www.education.rec.ri.cmu.edu/previews/robot_c_products/teaching_rc_tetrix_preview/variablesfunctions/debugging/debuggingtechniques/videos/debuggingtechniques.html

Code:
task main()
{
   motor[motorC] = 100;
   motor[motorB] = 100;
   wait1Msec(5000);


   motor[motorC] = -100;
   motor[motorB] = 0;
   wait1Msec(800);

 /*  motor[motorC] = 100;
   motor[motorB] = 100;
   wait1Msec(5000);

   motor[motorC] = -100;
   motor[motorB] = 0;
   wait1Msec(800);

   motor[motorC] = 100;
   motor[motorB] = 100;
   wait1Msec(2000);

   motor[motorC] = -100;
   motor[motorB] = 0;
   wait1Msec(800);

   motor[motorC] = 100;
   motor[motorB] = 100;
   wait1Msec(2000);*/
}


Sat Jul 13, 2013 9:37 pm
Profile
Rookie

Joined: Sun Jul 07, 2013 11:48 am
Posts: 11
Post Re: Labryinth
parkway wrote:
Try breaking down your code some more. I always try to test one or two movements at a time. I pasted your code below, but I commented out everything after the first turn. Try running that code and see what your robot does.

Also, to Ryan's point about highlighting program executing, you can also try stepping through your code to see what your program is doing at certain points: http://www.education.rec.ri.cmu.edu/previews/robot_c_products/teaching_rc_tetrix_preview/variablesfunctions/debugging/debuggingtechniques/videos/debuggingtechniques.html

Code:
task main()
{
   motor[motorC] = 100;
   motor[motorB] = 100;
   wait1Msec(5000);


   motor[motorC] = -100;
   motor[motorB] = 0;
   wait1Msec(800);

 /*  motor[motorC] = 100;
   motor[motorB] = 100;
   wait1Msec(5000);

   motor[motorC] = -100;
   motor[motorB] = 0;
   wait1Msec(800);

   motor[motorC] = 100;
   motor[motorB] = 100;
   wait1Msec(2000);

   motor[motorC] = -100;
   motor[motorB] = 0;
   wait1Msec(800);

   motor[motorC] = 100;
   motor[motorB] = 100;
   wait1Msec(2000);*/
}


For what you are saying... The debugger window does not stay open until after it is done debugging. I have actually 2
questions.. Question 1: How do you make the debugger stay open so that I can control the debugging process? Question 2: Do I use the debugging process on my code or the code in the video? If it is the code in the video.. I cannot find that sample program. And if you could be so kind and direct me to that code.

Thanks,
Jonathan


Sun Jul 14, 2013 5:29 pm
Profile
Moderator
Moderator

Joined: Mon Oct 04, 2010 2:18 pm
Posts: 196
Post Re: Labryinth
Under the Robot tab there is a command to open the debugger window manually, but when you go to step through you won't be able to see your virtual robot. My advice was better served for a physical robot. My mistake. Let's try this: Run the program as I have it, with the bottom part of your code commented out. Compile and download your program. Before you start the program, open up the debugger windows. Go to the Robot tab > debugger windows > motors.

Now run your program . The motors debugger window should tell you what your motor is actually doing. According to the code motors B and C should go at 100 power for 5 seconds. Then, motor C should go to -100 and motor B should go to 0. Watch your program a few times and see if that is what is happening.


Sun Jul 14, 2013 9:02 pm
Profile
Rookie

Joined: Tue Nov 26, 2013 12:11 am
Posts: 1
Post Re: Labryinth
Good job i appreciate your work.

_________________
http://www.besttotalcare.com/


Tue Nov 26, 2013 12:13 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 7 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.