ROBOTC.net forums
http://www.robotc.net/forums/

breakpoints causing errors
http://www.robotc.net/forums/viewtopic.php?f=55&t=9639
Page 1 of 1

Author:  beefy1875 [ Sun Oct 26, 2014 11:28 pm ]
Post subject:  breakpoints causing errors

Hi,

I have 2 problems with breakpoints and the RVW.

Line 1 of my program turns on the left motor, line 2 turns on the right motor. I then put a breakpoint on line 2. When run on an actual NXT, the program turns on the left motor and pauses as expected. When run in the RVW, the program pauses, the motors debugger window says the left motor is turned on, but the robot does not move. Does anyone know why?

The second problem: in basic user mode, you can not access the program debug window. I read on another thread that this window is hidden intentionally and you can get the same functionality by using the play, pause, and reset buttons in the RVW window. However, in my program above, i added a wait command after setting the motor power levels and put a breakpoint on it. With the RVW window play button, the program first pauses on the task main() line, then the breakpoint, then doesn't move, then pauses at the end of the program. Throughout all of this, the robot doesn't move. If I change the user mode to expert, open the program debug window, and use start and resume, the program behaves how I would expect, pausing in the code at the breakpoint and moving the robot forward when the wait command is executed.

Any help in resolving these issues would be greatly appreciated.

Thanks.

Author:  lcarrozza [ Tue Oct 28, 2014 12:55 pm ]
Post subject:  Re: breakpoints causing errors

beefy1875,

Unfortunately break points are not cleanly supported in Robot Virtual Worlds (RVW). The reason being, when ROBOTC hits a break point, it suspends the program in RVW. When a program is suspended in RVW, the physics are turned off. This will cause you robot to be stationary although the motor is on. We will be sure to look into a way to improve this in the future.

An alternative method is to use wait commands instead of break points in your program. This will allow you to have time to see motor values, sensor values, ect. while your program "waits" instead of suspends. Using your example from above, you can set it up like this:
Code:
task main()
{
   motor[motorB] = 50;
   wait1Msec(5000); //Wait 5 seconds before continuing on to the next step of the program
   motor[motorC] = 50;
   wait1Msec(5000); //Wait 5 seconds before continuing on to the next step of the program
}


Please let me know if you have any more questions.

Thanks, Lee

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/