I must be missing something with Python

Ok, I have my right arm & hand built and trying to make it do something with MyRobotLab by voice command.

 
I have read through the forums on both InMoov & MyRobotLab and it seems that I am missing something.
 
These are the steps I follow:
      1) Physically connect everything.
      2) Launch MRL.
      3) Start a runtime of Python.
      4) Load InMoov.Right.hand.py (Com has been changed for my arduino & the initial ino has already been loaded)
      5) Press Execute
      
Sit and wait, nothing happens but the message "68313 [Python] INFO  class org.myrobotlab.service.Python  - exec" on the bottom of the screen.
 
I looked through the Python script and it calls for the starting of the InMoov service & setting up the arduino and has the voice commands.
 
If I manually launch the InMoov service, launch the "Right Hand", connect to the arduino and attach each servo individually, I can move each servo using the slider.
This tells me the communications are correct.
 
I wanted to use the script and control by voice but the script doesn't seem to want to work.
 
So what am I doing wrong, because it sure seems like a lot of people here have gotten it right.
 
I welcome any and all help.
 
Thanks
 
GroG's picture

Hello And Welcome  MajorDKSE

Hello And Welcome  MajorDKSE !

Step 1.5 - (only needs to be done once) - Copy & Paste the contents of the Arduino - editor tab into a "real" Arduino IDE and upload it to your board(s)

Step 5.5 - if it NO WORKY - then send a NO WORKY ! :)
See Here how to send a noWorky ...

If you familiar with Douglas Adams' books its on the same level as a 

MajorDKSE's picture

Still won't run python script

GroG,

Thanks for the reply.

For your step 1.5, I have already downloaded the initial files to my arduino and if I launch all the required services manually, I can use the sliders and turn each of the servos.  

But if I try to execute the python script, it just sits there with the line:

99908 [Python] INFO  class org.myrobotlab.service.Python  - exec 
 
What am I missing?
 
Thanks
GroG's picture

Not sure, do Step 5.5

Not sure, do Step 5.5

hairygael's picture

Hi

Hi Eddy,
InMoov.Right.hand.py is for a previous version of MRL (1695).

So you are trying to run an old script with a recent version of MRL.

With the recent version you need to run script : InMoov2.xxxx
 

Try the InMoov2.minimal.py:
https://code.google.com/p/myrobotlab/source/browse/trunk/myrobotlab/src/resource/Python/examples/InMoov2.minimal.py

MajorDKSE's picture

Still won't run python script

Hey Gael,

Thanks for the reply.

I downloaded the InMoov2.minimal.py script you linked, but it still does the same thing.

"99908 [Python] INFO  class org.myrobotlab.service.Python  - exec "

 

Am I following the proper steps?

1) Launch MRL

2) Launch the runtime of Python

3) Open the InMoov2.minimal.py script

4) Press Execute

 

Looking at the script, it appears that it should be loading all the services, connecting to the arduino & attaching the servos all by itself, is this correct or do we have to do those steps manually?

 

One other thing, when I lauch the InMoov service, it will open another python tab, is this right?  It seems redundent.

 

One side note, knowing that this is running under Java, I upgraded to the latest release 7.67 to see if it would help, no difference was observed.

 

Any insight would be greatly welcomed.

wvantoorn's picture

Beware, if you make a tab for

Beware, if you make a tab for python, watch for it that you call it python and NOT Python, so no Uppercase letters, just lower case letters!!!!!

There were a few who had that problem, including me, and it was a pain to find.

 

Gr. Wilco

PS, you were having problems with your servos wasnt it? Are you running the servos from a battery 6V 12AH or from a power supply unit 12V and just  a little amps?

MajorDKSE's picture

Python script issue.

Gr. Wilco,

I think you may have hit it on the head!!!!

I usually cap the first letter when I'm programming and know that I did cap Python when I activated the service.

I will have to try it this evening when I get off work.

As for my servos, I am running them on a separate PS, but I do have a ground wire between the servo/arduino PS.

They work fine with the sliders but could not get the python script to run.

Thanks again for the info.

I will reply with the results.

Damon

wvantoorn's picture

Since there were a number of

Since there were a number of updates, there were some big changes, and one of them beeing that the python service is not autostarted. This wasnt before the big change from google to github. So that problem wasnt there before.

So when you start a python service, remember Not to use Uppercase letter P first. just write python and you should be ok. In that service only use the *2*.py scripts otherwise again new errors.

It is also very important to know that from 1.** and up we have to use the inmoov2**.py scripts, the other ones are for older MRL editions.

 

Hope that this has solved your problem

MajorDKSE's picture

Python script not running

First off, thanks for everyone's suggestions.

Starting the python service using all lower case still did not allow it to run, but I did make progress.

After it still didn't run, I went back to some tutorials and looked on how to start services from python.

If I typed the line "i01 = Runtime.createAndStart("i01", "InMoov")" all by itself and pressed execute, the InMoov service started under the name i01.

This told me something was preventing the script from running. 

I then started copying the InMoov2.minimal.py file, line by line into the python tab and executing after each line (relaunching MRL between each line test).

It ran the script each and every time.  I eventually had the entire script copied over and everything ran as expected, but I still have the problem.

If I load the script using "File/Open", the script will not run, same error as before.

If I copy/paste the script into python, it runs as expected.

If I save the script after verifying that it will run, the now saved file will not run when reloaded in a fresh MRL, same error as before.

I am using Windows Vista Notepad for all this copy/paste so there should be no hidden characters.

Tomorrow I will try creating the file on another machine and then transferring it to my laptop for testing.  This will tell me if my system is corrupting the file somehow.

Any other suggestions would be welcomed.

Thanks again.

 

MajorDKSE's picture

Python script will not run

Hey,

Does anyone have an idea as to why the python script InMoov2.minimal.py will not run if loaded via file/load but will run if copy/paste?

Would really like to automate the startup.

Thanks

 

beetlejuice's picture

hi

Hi, did you tried to make a new file InMoov2.minimal.py?

I guess for copy/paste, you open InMoov2.minimal.py in the blocNote, copy all and paste in the python window of MRL , right ?

Did you tryed to open it in blocNote, save it , and after, tryed to open this "new" InMoov2.minimal.py file with MRL ?

I've already got this problem and make this solved it .

You can also save it with the name you want like "myScript.py" ( don't forget the ".py" ! ) and like explain on this page, make an autostart : http://myrobotlab.org/content/starting-python-and-or-any-other-service-or-script-startup

java -jar myrobotlab.jar -service gui GUIService python Python -invoke python execFile myScript.py

This tells the Service name "python" to run the exeFile method with the parameter of "myScript.py" .. so basically execute myScript.py on startup.

 

GroG's picture

Nice Beetle ! o/

Nice Beetle ! o/

MajorDKSE's picture

No Worky of the problems

Ok,
 
I just sent two no-workies.
 
The first one was trying to run the py file when loaded by the file/open menu command.
 
The second no-worky is copy/paste of the py file.  The unit will display my voice command, most of the time, never asks for comirmation and does not move the servos even though it says that it is.  I can move the sliders and the servos work manually.
 
I noticed that the tx/rx lights on the arduino blink when using the sliders but do not blink when using the voice commands.
 
Hope this leads to a solution.
 
Thanks for the help everyone.