What to do, what not do, and where it pays to be cautious! This posts throws light on some very important aspects of programming robots in NXT-G.
Any program that we write for NXT-G should work without crashing, without lagging, and it should be light on the processor and as well as the memory!
What to do!
- Delete files that are not required on the NXT Brick. (take backups of files first if you require)
- Removing system files from the NXT brick won’t hurt! (you can always download the firmware if you need to get them back)
- Always give a self explanatory name to the program while working in NXT-G. This name is inherited by default and shows up in the Menu of the NXT Brick.
- Either use Move or Motor, and reuse it often. Instead of using both. This eats up memory.
- Reuse programs / code by creating your own blocks (My Block). This saves a lot of memory.
- Save often. This really helps you when we do some weird program and the NXT window crashes!
What to avoid!
- Minimize use of Sound blocks – This will suffocate the memory! Remember the NXT brick has limited memory!
- Avoid using the Record/Play Blocks and File Access – Reduces the speed of execution.
- Avoid using Text Strings to represent numbers. (Use Numeric or Logical Values only) – Takes extra memory in variable declaration. And it is not a correct practice to store Numeric Variables in Text String format, we might want to use these for calculations later! Text String numbers cannot be used with Math operators.
- Avoid using too many pictures/icons – Again, just like your Sound, it will fill the space, and decoding the images will also take much time for the small processor to work with.
- Don’t make your program messy… use My Blocks a lot or break down your program to small blocks. – My Blocks will give a clean environment and make debugging much easier. You might need to make others understand what your program is about, Right? Also, this will save a LOT of memory when you reuse a part of the program!
Good Luck to you all…
Academy of Robotics
www.AcademyofRobotics.net @ LEGOengineering
The following two tabs change content below.
Srikanth M. is the Director of Academy of Robotics, a startup from Visakhapatnam, India. Academy of Robotics has 20 centers across India for students from 4 years to high school, supporting STEM, creative architecture, experiential learning, problem solving, rapid programming, advanced electronics, and embedded systems.
Latest posts by Srikanth M (see all)
- NXT-G power programming tips - 7 September 2013
- Clicking brick syndrome - 25 May 2013