SparkFun Forums 

Where electronics enthusiasts find answers.

General project discussion / help
Did you make a robotic coffee pot which implements HTCPCP and decafs unauthorized users? Show it off here!
By clplaneguy
I have been programming for the LEGO EV3 in Java to learn and improve the GyroBoy self-balancing robot. In the process, a long and detailed correspondence was created at the LeJOS forum. As the process went on, I found out that Java has Garbage Collection which interferes with a real-time process. On making note of this on the forum, all of my posts were promptly deleted because it became obvious to me that the project should not be in Java Lego but rather C++ Arduino. I no longer have access to my leJOS posts and notes. However, my last post was composed in Word and I do still have that record. I include it here for others to review.

Just a thought, would BB be Brian Bagnall?

I have been through quick and easier projects that have turned out to be entirely too trivial. After all, Lego electronics at its beginning is for the junior High-School level. Those Junior High-School and High-School projects are busy projects for me. Just something to do. When the project is complete, I have used up some of my time, but have not learned anything. Projects of this complexity are not good for me to learn from but rather for me to teach someone else with. I am looking for a project complex enough that I can use it as a motivational target while learning techniques of at least a college freshman level. A project with the complexity of a fourth-year college computer-science curriculum level would be overly ambitious at this time.

I have been putting a lot more work (in silence) into my balancing robot project. I apparently have reached a limit with Lego and leJOS with the Garbage-Collection issue. The literature confirms with statements that Garbage Collection and real-time processes are not a good combination. They may conflict with each other. If the balancing robot can be programmed for leJOS 0.9.1 in Java avoiding the Garbage-Collection issue (or making judicious use of it), then I will leave that progression to someone else that is more interested and knowledgeable of deep Java.
To date, this project has taught me about

Lego, ev3dev, C (.h .cpp libraries), PID, leJOS, Java, IMU, I2C?, Arduino INC, Arduino IDE, Raspberry Pi, Git, GitHub, Git Desktop, statement execution times, Makeblock INC, Eclipse, Visual Studio, and Garbage Collection.

Also, all of this computer work, internet surfing, and computer crashes have royally messed up my computer. So, I have had to learn how to format a hard-drive, partition, install Windows 7, check for malware and backup my data files. I still need to learn and do a hard-drive clone.
Personally, I find that dumping numbers to a data file is of no help. That sounds like part of a bump test. Which is beyond me. Without some advanced technique to analyze the data, there is no need to collect it. This being the case, there is no false test for the balancing robot. The only test is the real world. Even this little slow controller is faster than a human(me). Simply looking at a data dump (numbers or graph) is not sufficient to provide any kind of productive understanding.

I have ended my studies with Lego and moved on to Arduino. My Makeblock Ultimate 2.0 board gives every indication that it is an Arduino or an Arduino clone (ATmega2560). Makeblock does have a balancing robot that is controlled with a phone or tablet. The code is proprietary and not open source. So, I am using a code sample from the internet by Joop Brokking in C++. Joop’s style is to not use any libraries. This is beyond me at this point. So, I will use Joop’s code as a motivation to learn the Ultimate (Mega2560) libraries written in C++.
I have no moral issue with crediting the work of previous programmers. More power to them. I give those credits in my posts, program forward and on each line. I search for and use all references, programs and code snippets I can find on the internet. My task then becomes to carefully merge the best techniques and most useful code for my purpose. Sometimes code from different sources conflict. Variable names or code structure may be different. As I merge code, it is beneficial to know the original source for any given line of code. At later stages, this is difficult to trace but knowing the source can be a hint to the issue. This is where the end-of-line credits become beneficial. All copied code is credited with the author. As I understand and change the code, the original source is no longer valid and the credit is removed. At this point, it is more instructive to add functional documentation.

I understand your lack of interest in my project. After all, it is my project(education) and not yours. Knowing a programing language is one thing, but teaching it is something entirely different. I know that for myself, I am moving past the idea of teaching this knowledge to my children and onto furthering my knowledge of the microprocessor and what it can do for me. On that note, I wish to sincerely THANK YOU for your abundant and insightful assistance. Your knowledge on this subject is extensive and mine is almost nonexistent. What you consider trivial for me is unknown. I have stated earlier the subjects that I have learned as a result of this project. You have provided information and pointed my efforts in directions that I would not have otherwise gone.

At this point I have the balancing robot working on the Makeblock platform with the PID values from Joop. I can even Serial.println(); while the robot balances. I am starting to remove the libraries. However, the PID parameters are not optimized because as I change the code the optimized values change. So, I am at the point of removing the libraries while maintaining a robot that actually balances only pretty well.
For the future, I have a 1,000-peace jigsaw puzzle that I cannot solve. I have downloaded a program from GitHub to do this. It works in the YouTube video and there are comments to that effect. Text states that OpenCV is used to do the video(picture) processing. I wonder if something like the Google glass would be beneficial with this project. With this project I again become a virgin.

Any kind of assistance you can provide (believe me) would be GREATLY APRECIATED.