Hello everyone! How do I add new Python libraries to myrobotlab. So that my Python 3.7.7 scripts can work?

GroG

2 years 11 months ago

Hello alexstarter,

Myrobotlab uses Jython,  
Jython is still at 2.7 - here is their "roadmap" to Jython 3 - https://www.jython.org/jython-3-roadmap

Myrobotlab creates a directory called pythonModules - if you have non-native 2.7 libraries, you should be able to add them to that directory and they will be accessable

Hello Grog!
I didn't understand everything.
Do I need to update jython? Or should I just install my libraries in the pythonModules folder?
 
 

Hello Grog!
Unfortunately, I was not able to make my code friends with myrobotlab.
Perhaps there is another way to send data from my Python 3 script (like "Hello") to myrobotlab?
My script works with Yolov5 and recognizes objects by webcam.
I need the robot to say what was recognized (for example, the class number of the object).
Можете ли вы помочь мне на примере? Что писать в mrl и что писать в моем коде?
Может это можно сделать через «WebGui»?

 

This is quite easy - myrobotlab methods are all accessable through http or ws message requests.
You'd just have your python script uses requests to make the calls 
https://docs.python-requests.org/en/latest/

if you have a LocalSpeech service called mouth

http://localhost:8888/api/service/mouth/speak/hello
http://localhost:8888/api/service/mouth/speak/i
http://localhost:8888/api/service/mouth/speak/see
http://localhost:8888/api/service/mouth/speak/a
http://localhost:8888/api/service/mouth/speak/cup

You can post a websocket message which is more effecient.

More documentation is here - http://myrobotlab.org/content/myrobotlab-api

One person even made a python lib for it - (although this is not supported - and have no idea if it still works)
https://github.com/AutonomicPerfectionist/mrlpy 

It's been quite a while since I've had the time to update mrlpy, as I recall basic commands should still work if Nixie's HTTP API is still compatible with Manticore's, however I know for a fact that more advanced features like compatibility mode and python-based services do not work in Nixie. So mrlcommand should work, everything else probably not.

I would really like to get back into developing it but unfortunately college has sucked up all my available time.

Hi GroG!
I figured out why it didn't work for me. I needed to enter:
http: // localhost: 8888 / api / service / i01.mouth / speak / hello
But, in this way, I can send one word at a time.
Spaces between words are replaced with% 20

Is there a way to send a whole proposal?
For instance: 'Hi GroG how are you'

 
I've got one more question.
Can I open a separate * .py file from myrobotlab and pass arguments to it.
Example:
python detect.py --img 416 --weights C: /yolov5/runs/train/exp11/weights/best.pt --conf 0.60 --source 0