Troubleshooting issues with NXT 2.0 Robot

Share your building instructions or ask questions about constructing your robot
paulharv66
Posts: 10
Joined: 26 Oct 2011, 22:30

Troubleshooting issues with NXT 2.0 Robot

Post by paulharv66 »

Hi,
I just joined the forum - mainly on behalf of my son.

I'm starting off with a general question - if a robot/program does not behave as expected, or behaves inconsistently, what's the best approach to figuring out if it's a programming problem or a problem with the NXT itself?

I have tried to communicate with the Mindstorms support guys - even sending them a program that my son wrote and video of it misbehaving - but this has been a pretty luckless effort so far.

I feel like we need to sit down with an expert who can look at the bot, look at the program and tell us why it's behaving as it is!

Pretty much every bot my son has built has either not behaved as expected, or has sometimes behaved as expected and sometimes not. The bots and programs are simple (with simple color detection, path following etc) and when I look at them they make sense - the logic looks reasonable.

Any suggestions where to go from here?

Thanks so much
:roll:
spillerrec
Posts: 358
Joined: 01 Oct 2010, 06:37
Location: Denmark
Contact:

Re: Troubleshooting issues with NXT 2.0 Robot

Post by spillerrec »

If a program is misbehaving it is usually because of either:
  • You think the program does something, but it is actually doing something (slightly) else.
  • You forgot to take something into account
I will try to write some examples tomorrow. While they sound like errors only "stupid" people would make, it happens all the time even for the best people out there.

So one approach to the first issue is to ask another person to look trough your program, but without telling too much about what it does. When he have grasped an understanding of the program, make him tell you how it works. Did his explanation match exactly what you thought it did? If not, how and where did it differ? It is often just small differences, but they can have big consequences.


With the other issue, you can approach it by trying to do the program manually. Go through the program step-by-step in different situations, without thinking, without assuming how anything works. What happens and how does the program handle it? Are some situations handled in a way that doesn't make sense in that specific situation?

The problem with this approach together with robotics is that sensors receive external input and it is difficult to predict this exactly.
Consider a line following robot which takes input from a light sensor. If the amount of light in the room increases a lot, the light sensors reading becomes higher and it might have difficulty to differentiate between black and white.
Another aspect of the issue is that the robot will not have the same start conditions. Slight changes in the start position and direction will make the program run completely different from before. (The goal in robotics is to make the result of the program as similar as possible no matter how the conditions were before, now and in the near future.)

So since it is difficult to run the program by yourself, you can instead try to get it explain to you what it is doing. You can do this with sound, make it Beep in certain ways depending on the situation, or you can do it using the in-built display.
When you then run the program, try to notice which situations often happens when the program misbehaves. Did it do something which it shouldn't have done here? Or did it think something happened (and reacted based on this) which actually did not happen?
My blog: http://spillerrec.dk/category/lego/
RICcreator, an alternative to nxtRICeditV2: http://riccreator.sourceforge.net/
paulharv66
Posts: 10
Joined: 26 Oct 2011, 22:30

Re: Troubleshooting issues with NXT 2.0 Robot

Post by paulharv66 »

Thanks so much for you answer - really appreciate it.
So it's not unheard of to have even a simple robot and simple program misbehave...that's actually good to know!
Is this forum a good place to upload a program and have someone look at it?

My son's current bot/program basically grabs balls of different colors, and does one thing with blue balls, and something else for other colors. It sometimes does this correctly and sometimes not. (Initially he had it set to treat red balls in a special way and it would not, then he changed it to blue and it started working, but only sporadically. This makes me question if the unit is actually working properly.)

Other issues we've seen - he had a track following bot and it worked ok when going clockwise around the track. It followed the track and would speak the name of a color when it hit a colored square. When he had it go anti-clockwise it would go off into some different branch of logic when it detected a colored square, and get stuck in a loop.

Cheers,

Paul
h-g-t
Posts: 552
Joined: 07 Jan 2011, 08:59
Location: Albania

Re: Troubleshooting issues with NXT 2.0 Robot

Post by h-g-t »

Best if you post your code here (or a link to it on another site if it will not post).

If it is written in NXT-G then use the 'pack and go' option to make sure everything is included.
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
paulharv66
Posts: 10
Joined: 26 Oct 2011, 22:30

Re: Troubleshooting issues with NXT 2.0 Robot

Post by paulharv66 »

Tried posting the *.rbt file, but it doesn't upload. No error or anything - just nothing uploads.
Any suggestions where I might post it - I don't have a website or access to a publicly viewable one?
Anyone happy for me to email it to them?
Cheers
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: Troubleshooting issues with NXT 2.0 Robot

Post by mattallen37 »

zip it and upload the zipped file.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
paulharv66
Posts: 10
Joined: 26 Oct 2011, 22:30

Re: Troubleshooting issues with NXT 2.0 Robot

Post by paulharv66 »

Excellent - it uploaded - thanks.
RobotBall.zip
(644.56 KiB) Downloaded 687 times
hassenplug
Posts: 346
Joined: 27 Sep 2010, 03:05
Contact:

Re: Troubleshooting issues with NXT 2.0 Robot

Post by hassenplug »

Your program seems pretty simple & straight-forward.

I suspect the problem is that the color sensor does not do a good job of identifying the color of the ball. The sensor has to be pretty close to an object to correctly identify the color, and the round balls make that a little harder.

One suggestion: Take out all the movement after it identifies the ball, and simple have it show (or say) the color of the ball. See how many times that comes out correct.

Next question, is the program executing as you would expect, assuming it didn't correctly identify a ball? (ex: it may continue moving, as if it didn't see the ball, or it may do the wrong sequence of moves. But when it executes a sequence of moves, is the sequence as you would expect, even if it's for the wrong color ball)

Steve
---> Link to lots of MINDSTORMS stuff under my picture --->
paulharv66
Posts: 10
Joined: 26 Oct 2011, 22:30

Re: Troubleshooting issues with NXT 2.0 Robot

Post by paulharv66 »

Thanks.
We'll try out the troubleshooting steps.
paulharv66
Posts: 10
Joined: 26 Oct 2011, 22:30

Re: Troubleshooting issues with NXT 2.0 Robot

Post by paulharv66 »

Attached is a modified program - dead simple.
The expected behavior is:

- Go forward until it detects a ball
- If color is blue says "Blue" then exits program and stops
- If color is red, green or yellow says "Malfunction" and continues going forward/looping

The behavior we're actually seeing is erratic:

- Detects blue and just stops (doesn't say "blue")
- Detects blue and says "blue" but continues going forward/looping
- Detects blue and says "malfunction"
- Detects red, green or yellow and says "malfunction" (correctly)

So the "blue" condition is inconsistent.

Other troubleshooting steps:
- We've tried it in a dark room.
- We've tried holding balls directly under the sensor
- Changing batteries

It seems there are three possibilities
- The program is not written correctly for the desired behavior
- The color-sensor is not working right
- The NXT block is not working right

Any input would be greatly appreciated!

Thanks
Attachments
RobotBall3.zip
(223.14 KiB) Downloaded 439 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest