Byte Article, Aug 1979 - the three muscle system

[From Adam Matic, 2013.03.07.0050 CET]

If you’ve read Bill’s 1979 Byte article series titled The Nature of Robots, you may have seen the Three Muscle Systems program written in the old NorthStar Basic.

Here’s a revamped Processing version. The code is pretty much the same, variable and function names are the same, no objects or classes.You can easily use the Byte article to study the code. The only difference are the added drawing subroutines to visualize what is going on. To set reference X and Y, just click the mouse somewhere close to the center of the system. If you wish to increase muscle tone, press ‘i’, to decrease it press ‘u’ (+/- 10 units).

Attached is a picture of the program running.

Here’s the program with sourcecode: https://dl.dropbox.com/u/70399093/Byte%2C%20aug%201979.zip

Here’s a link to Bill’s article: http://www.livingcontrolsystems.com/enclosures/byte_aug_1979.pdf

If you wish to alter the code, you will need Processing: http://processing.org/

That’s it. Have fun.

Adam

ThreeMuscleSystem.PNG

[From Rick Marken (2013.03.06.1650)]

Adam Matic (2013.03.07.0050 CET)—

AM: If you’ve read Bill’s 1979 Byte article series titled The Nature of Robots, you may have seen the Three Muscle Systems program written in the old NorthStar Basic.

Here’s a revamped Processing version. The code is pretty much the same, variable and function names are the same, no objects or classes.You can easily use the Byte article to study the code. The only difference are the added drawing subroutines to visualize what is going on. To set reference X and Y, just click the mouse somewhere close to the center of the system. If you wish to increase muscle tone, press ‘i’, to decrease it press ‘u’ (+/- 10 units).

RM: Well now I’m sold. I was able to run this in a browser off of a server and I could even do it from a browser on my iPad! Processing apparently assumes that touch screen input is the same as mouse input.

I’d be completely sold (and would be willing to spend the remaining years of my life learning Processing) if it were possible to run a tracking program on a tablet browser. I wonder whether the touch input is crisp enough to allow pretty good control.

So, Adam, could you program up a Processing version of my “Nature of Control” demo (http://www.mindreadings.com/ControlDemo/BasicTrack.html) for the web. Then I can see how it works on a tablet and if it works well I’ll abandon java and enter your brave new world of Processing.

Best

Rick

···


Richard S. Marken PhD
rsmarken@gmail.com
www.mindreadings.com

[From Adam Matic 2013.03.07.0200CET]

Rick Marken (2013.03.06.1650)]

RM: Well now I’m sold. I was able to run this in a browser off of a server and I could even do it from a browser on my iPad! Processing apparently assumes that touch screen input is the same as mouse input.

I’d be completely sold (and would be willing to spend the remaining years of my life learning Processing) if it were possible to run a tracking program on a tablet browser. I wonder whether the touch input is crisp enough to allow pretty good control.
AM:

I’m not sure, we should test it. One thing to look into would be touch input, another would be the frame-rate and sampling frequency. Browser-app made in Processing is actually JavaScript. Any JavaScript limitations apply here.

So, Adam, could you program up a Processing version of my “Nature of Control” demo (http://www.mindreadings.com/ControlDemo/BasicTrack.html) for the web. Then I can see how it works on a tablet and if it works well I’ll abandon java and enter your brave new world of Processing.

AM:

Sure! Processing is based on Java, it should be fairly simple to convert the program. Mail me the code, and we can start testing in no time.

Adam

[From Rick Marken (2013.03.06.1725)]

Adam Matic (2013.03.07.0200CET)

RM: Well now I’m sold. I was able to run this in a browser off of a server and I could even do it from a browser on my iPad! Processing apparently assumes that touch screen input is the same as mouse input.

I’d be completely sold (and would be willing to spend the remaining years of my life learning Processing) if it were possible to run a tracking program on a tablet browser. I wonder whether the touch input is crisp enough to allow pretty good control.

AM: I’m not sure, we should test it. One thing to look into would be touch input, another would be the frame-rate and sampling frequency. Browser-app made in Processing is actually JavaScript. Any JavaScript limitations apply here.

RM: Yes, let’s test it. Processors are so fast now that I think the animation should work fine. The big question for me is whether the existing screen read code is good enough or whether there is some way to refine the touch location (if necessary) so that it gives a more precise (vernier?) measure so that the controlling can be better. But we’ll see.

AM:

Sure! Processing is based on Java, it should be fairly simple to convert the program. Mail me the code, and we can start testing in no time.

RM: OK, I’m attaching my code for all to see. It’s pretty ugly and not well documented but it works;-)

Good luck. Thanks for doing this Adam!

By the way, the main code is in BasicTrack.java. I wrote the Applet class separately for some reason. But that was long ago when I was just trying to learn java; I’m actually still at the same level; I suck at writing OOP code.

Best

Rick

BasicTrackApplet.java (1.12 KB)

BasicTrack.java (4.02 KB)

···


Richard S. Marken PhD
rsmarken@gmail.com
www.mindreadings.com

[Martin Taylor 2013.03.06.20.48]

documentation, the main hassle with web-based applications occurs
when you want to work with files. Check out
< and click the tab
“Javascript (Processing.js)” to see what language words are greyed
out. Most of them have to do with files, but there are others.
When you write a Processing program, you write it once, and then
export it to whatever platforms you want, at least to Mac, Windows,
Linux and Web, or at least I think that is the list. Adam can
correct me.
Martin

···

[From Adam Matic 2013.03.07.0200CET]

Rick Marken (2013.03.06.1650)]

      RM: Well now I'm sold. I was able to run this in a browser off

of a server and I could even do it from a browser on my iPad!
Processing apparently assumes that touch screen input is the
same as mouse input.

      I'd be completely sold (and would be willing to spend the

remaining years of my life learning Processing) if it were
possible to run a tracking program on a tablet browser. I
wonder whether the touch input is crisp enough to allow pretty
good control.
AM:

      I'm not sure, we should test it. One thing to look into

would be touch input, another would be the frame-rate and
sampling frequency. Browser-app made in Processing is actually
JavaScript. Any JavaScript limitations apply here.

http://www.processing.org/reference/alpha.html

AM:

Here’s the link: https://dl.dropbox.com/u/70399093/NatureOfControl.zip

Processing programs compile to Java and run in JVM, and that is the reason they can be run on different platforms. As Martin said, that includes Windows, Linux, MacOS, Android…

For the web, there is the Processing.js option, in which the code is not compiled to java but is interpreted in the browser by the Processing.js interpreter. The browser sees it as a HTML 5 Canvas. That means that if you have the program running on a server, you can alter the code in any text editor (you still don’t have to download the Processing IDE). That also means it might run slower, and it can’t save any files.

(there are some workarounds for saving files. Martin, you might be interested in http://www.learningprocessing.com/tutorials/php/ )

The code is pretty much a verbatim copy of your java code, you will see right away what goes on. Some differences:

Every program has a setup() and draw() function. After the first one is executed, the second one loops continuously. I’ve put them in the beginning of the code.

doubles are now floats (since trig functions work with floats)

g.drawRect() is just rect()

DrawString() is text ()

double.toString() is nf()

and some other minor differences.

I’ve set up the framerate to 20 frames per second. You will see it in the setup() function, and you can change it to test what happens.

The input will possibly need to be redesigned. If you don’t lift the finger during the task, everything should be fine. I’m not sure what happens when you lift the finger. Let me know how that goes.

Adam

···

On Thu, Mar 7, 2013 at 2:24 AM, Richard Marken rsmarken@gmail.com wrote:

RM: Yes, let’s test it. Processors are so fast now that I think the animation should work fine. The big question for me is whether the existing screen read code is good enough or whether there is some way to refine the touch location (if necessary) so that it gives a more precise (vernier?) measure so that the controlling can be better. But we’ll see.

[From Rick Marken (2013.03.07.0910)]

···

On Thu, Mar 7, 2013 at 4:14 AM, Adam Matic adam.matic@gmail.com wrote:

AM:

Here’s the link: https://dl.dropbox.com/u/70399093/NatureOfControl.zip

Processing programs compile to Java and run in JVM, and that is the reason they can be run on different platforms. As Martin said, that includes Windows, Linux, MacOS, Android…

For the web, there is the Processing.js option, in which the code is not compiled to java but is interpreted in the browser by the Processing.js interpreter. The browser sees it as a HTML 5 Canvas. That means that if you have the program running on a server, you can alter the code in any text editor (you still don’t have to download the Processing IDE). That also means it might run slower, and it can’t save any files.

(there are some workarounds for saving files. Martin, you might be interested in http://www.learningprocessing.com/tutorials/php/ )

The code is pretty much a verbatim copy of your java code, you will see right away what goes on. Some differences:

Every program has a setup() and draw() function. After the first one is executed, the second one loops continuously. I’ve put them in the beginning of the code.

doubles are now floats (since trig functions work with floats)

g.drawRect() is just rect()

DrawString() is text ()

double.toString() is nf()

and some other minor differences.

I’ve set up the framerate to 20 frames per second. You will see it in the setup() function, and you can change it to test what happens.

The input will possibly need to be redesigned. If you don’t lift the finger during the task, everything should be fine. I’m not sure what happens when you lift the finger. Let me know how that goes.

RM: Well I’ll be damned!! It works like a charm on the tablet. Although the frame rate of 20 is too fast. But otherwise I can still do the tracking pretty well. I put it up at my website. You can run it via the browser on a tablet by going to:

www.mindreadings.com/BasicTrack/

Of course, this means that I’m now going to have to figure out how to use Processing. This could take a while, being that I am a relatively old (but still pretty frisky) dog trying to learn a new trick. So in the meantime, Adam, perhaps you could send me a version of the BasicTrack program with a frame rate of 10? And also I’d love to see how my “Mind Reading” program works in Processing. I’ll email the java version to you in a second.

Thanks so much for doing this Adam!! You have either manifestly improved (or ruined) my life. We shall see. But it’s really exciting to me to see that it is possible to run these programs on a tablet, which seem to be the new direction for computing.

Best regards

Rick


Richard S. Marken PhD
rsmarken@gmail.com
www.mindreadings.com

[From Adam Matic 2013.03.07.1930]

(Rick Marken 2013.03.07.0910)
Well I’ll be damned!! It works like a charm on the tablet. Although the frame rate of 20 is too fast. But otherwise I can still do the tracking pretty well. I put it up at my website. You can run it via the browser on a tablet by going to:
www.mindreadings.com/BasicTrack/

Great! I’m glad it works!

Of course, this means that I’m now going to have to figure out how to use Processing. This could take a while, being that I am a relatively old (but still pretty frisky) dog trying to learn a new trick. So in the meantime, Adam, perhaps you could send me a version of the BasicTrack program with a frame rate of 10?

AM: Sure, here’s the file, (it’s the same link as before, I uploaded a new version of the file):

https://dl.dropbox.com/u/70399093/NatureOfControl.zip

But, don’t download it just jet. Try this: open the previously downloaded web-export folder, then open the “NatureOfControl.pde” file in any text editor. The first few lines are variable declarations. Then you have the setup() function. It’s very short, you will immediately see how to change the frame rate. It’s very similar to java code. Then you upload the file on your server and that’s it.

Alternatively, you could double the execution time. Right after the setup() function, there is the draw() function. You change the line

if (Count > 150) stage = 2;

to

if (Count > 300) stage = 2;

Then, of course, you would need to change calculation parameters to accommodate for a larger data set. Every loop that goes to 150 should now go to 300. Probably would be best to make a static variable “data_length” if you choose to play with the size again.

RM: And also I’d love to see how my “Mind Reading” program works in Processing. I’ll email the java version to you in a second.

Thanks so much for doing this Adam!! You have either manifestly improved (or ruined) my life. We shall see. But it’s really exciting to me to see that it is possible to run these programs on a tablet, which seem to be the new direction for computing.

AM: No problem, really. It’s fun and I was actually going to ask you to send me the code from your site so I could study it. I like hoarding PCT code. :smiley:

I’ve downloaded the MindReading program, I’ll see what I can do.

Adam

[From Rick Marken (2013.03.07.1250)]

Adam Matic (2013.03.07.1930)

RM: Of course, this means that I’m now going to have to figure out how to use Processing. This could take a while, being that I am a relatively old (but still pretty frisky) dog trying to learn a new trick. So in the meantime, Adam, perhaps you could send me a version of the BasicTrack program with a frame rate of 10?

AM: Sure, here’s the file, (it’s the same link as before, I uploaded a new version of the file):

https://dl.dropbox.com/u/70399093/NatureOfControl.zip

But, don’t download it just jet. Try this: open the previously downloaded web-export folder, then open the “NatureOfControl.pde” file in any text editor. The first few lines are variable declarations. Then you have the setup() function. It’s very short, you will immediately see how to change the frame rate. It’s very similar to java code. Then you upload the file on your server and that’s it.

RM: Done! I am completely and utterly astounded. This thing called Processing does everything I wanted; it provides a simple programming environment (a text editor; I use EditPlus), does interactive graphics beautifully and runs in a browser on a laptop or mobile device (I used it on my iPhone while getting a haircut). I just cut the frame rate in half and the animation is still smooth as silk and the results I get using the tablet are the same as what I get using a browser: correlatoin of closed to 0.0 for C-M and C-D and -.99 for M-D. Try it yourself and see.

And I don’t have to learn a lot of new stuff apparently.

It was in 1996 that I discovered the web and started learning (to the extent that I did learn; I’m just a soft headed psychologists after all) to program in Java because I though it would be so cool to have a platform independent way of presenting the PCT demos. So it’s been nearly 20 years – a generation – since my last last efforts to move forward in computing so I guess I am ready to enter the new generation finally, where I can write stuff for mobile devices.

Thanks again, Adam. You went ahead and made my day;-)

Best

Rick

···

Alternatively, you could double the execution time. Right after the setup() function, there is the draw() function. You change the line

if (Count > 150) stage = 2;

to

if (Count > 300) stage = 2;

Then, of course, you would need to change calculation parameters to accommodate for a larger data set. Every loop that goes to 150 should now go to 300. Probably would be best to make a static variable “data_length” if you choose to play with the size again.

RM: And also I’d love to see how my “Mind Reading” program works in Processing. I’ll email the java version to you in a second.

Thanks so much for doing this Adam!! You have either manifestly improved (or ruined) my life. We shall see. But it’s really exciting to me to see that it is possible to run these programs on a tablet, which seem to be the new direction for computing.

AM: No problem, really. It’s fun and I was actually going to ask you to send me the code from your site so I could study it. I like hoarding PCT code. :smiley:

I’ve downloaded the MindReading program, I’ll see what I can do.

Adam


Richard S. Marken PhD
rsmarken@gmail.com
www.mindreadings.com