Python over PC (Win...
 
Notifications
Clear all

Python over PC (Windows 10)


Forum 1
(@osman)
Eminent Member
Joined: 7 months ago
Posts: 28
Topic starter  

Hello Milad,

I have a few questions.

Firstly, do you have a GUI (other than Solo Terminal) for us to use without the internet?

Secondly, I would like to know if it is possible to control my Solo units with Python library(Best via Spyder) via PC (Windows 10)? If so, what do I need to modify in the library? I think I would have to download pySerial 3.5 first.

Kind regards

Osman


SOLO Team liked
Quote
SOLO Team
(@milad)
Chief Member Moderator
Joined: 2 years ago
Posts: 251
 

Hi @osman

First I start with python, and the answer is of course!

so if you look at the library, you see if you use the python library in the Windows environment you need to pass the COM port that SOLO is detected in your initialization function like below, in my case, my PC detected SOLO on COM3 ( the baud-rate once you use the USB on SOLO is not important), so I had to change the sample code of temperature reading like below, and changing only the initialization function sending some new arguments so it doesn't use the default ones ( __solo_driver = solo.SoloMotorController(__solo_address,937500, "COM3") )

# EXAMPLE of how read the SOLO board temperature,
# every second we print the value of the temperature

import time
import sys

#Importing SoloPy
from SoloPy import solo_motor_controller as solo

# the device address of SOLO
__solo_address = 0

temperature = 0

def __loop():
    #Reading
    temperature = __solo_driver.get_temperature()

    # Print
    print("\n Read from SOLO -> Temperature: \n")
    print(temperature)

    time.sleep(1)


def __setup():
 #Initialize the SOLO object using the device address of SOLO at 0
    global __solo_driver
    __solo_driver = solo.SoloMotorController(__solo_address,937500, "COM3")
    while True:
        __loop()

def do_work():
    __setup()


if __name__ == "__main__":
    do_work()

 and as a result, I can read the temperature using the USB or send any commands... :

Forum 3

The same story can be applied once you use this library in Linux on PC or etc.

 

Posted by: @osman

Firstly, do you have a GUI (other than Solo Terminal) for us to use without the internet?

Motion terminal can be run offline, but you need to apply some tricks like below:

1) download motion terminal on GitHub ( download as a zip file)

https://github.com/Solo-FL/SOLO-Motion-Terminal

2) install live-server on your pc

https://www.npmjs.com/package/live-server

3) go in the uncompressed folder of motion terminal > open terminal (cmd) > and write: live-server

After this stage, the Motion terminal will be automatically come up in your default browser without any need for an internet connection.

Let me know if this was helpful.

Regards
Milad

 

If you found the answers helpful and you could solve your problems, please kindly verify here to help others in the future.


ReplyQuote
SOLO Team
(@milad)
Chief Member Moderator
Joined: 2 years ago
Posts: 251
 

BTW, I used Pycharm community as the compiler imported the whole folder of SOLO as a project ( you can also use pip command...):

https://www.jetbrains.com/pycharm/download/#section=windows

Forum 4

Milad

If you found the answers helpful and you could solve your problems, please kindly verify here to help others in the future.


ReplyQuote
Forum 1
(@osman)
Eminent Member
Joined: 7 months ago
Posts: 28
Topic starter  

@milad 

 

hey Milad,

I am soooo glad that I have such a cool service from you. I can't thank you enough.

My next question regarding the SOLO terminal as offline: Can I use the GUI (SOLO Terminal as offline) to control two SOLOs at the same time?

Kind regards

Osman


ReplyQuote
SOLO Team
(@milad)
Chief Member Moderator
Joined: 2 years ago
Posts: 251
 

@osman,

Glad to be helpful...

Posted by: @osman

My next question regarding the SOLO terminal as offline: Can I use the GUI (SOLO Terminal as offline) to control two SOLOs at the same time?

We are working on a new release of MT that can have different addressing, but still, it's in progress, so I believe it can be better to use Python for you to control the multiple units for now as it offers also very high flexibility, you can connect both SOLO's with USB to your PC and control them by assigning unique addresses to them ( you can do this part in Motion terminal in the signal section), using python, as we have lots of examples in our Git, including position controlling and with a little change you can use them for your purpose I believe.

https://github.com/Solo-FL/SoloPy/tree/main/examples

Let me know if you have other questions.

Regards
Milad

 

If you found the answers helpful and you could solve your problems, please kindly verify here to help others in the future.


ReplyQuote
Forum 1
(@osman)
Eminent Member
Joined: 7 months ago
Posts: 28
Topic starter  

Thank you Milad.

I will try to control two SOLO UNITs with Python.

Kind regards


ReplyQuote
SOLO Team
(@milad)
Chief Member Moderator
Joined: 2 years ago
Posts: 251
 

@osman,

Yes, that will be much better.

let me know if you had any questions.

Milad

If you found the answers helpful and you could solve your problems, please kindly verify here to help others in the future.


ReplyQuote
Forum 1
(@osman)
Eminent Member
Joined: 7 months ago
Posts: 28
Topic starter  

@milad 

hey Milad,

it's going to be a stupid question, but maybe you already know.
Can you please tell me how to install (include) an External Library (Solopy) on PyCharm?

I actually managed to install the library through PyCharm terminal but unfortunately I can't change the port number.

I could save some time and go straight to it and check my Solo directly if you could help me.

Thank you in advance.

Kind regards
Osman


ReplyQuote
Forum 1
(@osman)
Eminent Member
Joined: 7 months ago
Posts: 28
Topic starter  

@milad 

that should work, right?

https://www.youtube.com/watch?v=onL8xyP5VxA


ReplyQuote
Forum 1
(@osman)
Eminent Member
Joined: 7 months ago
Posts: 28
Topic starter  

ok, it worked as described in the youtube above.


ReplyQuote
Forum 1
(@osman)
Eminent Member
Joined: 7 months ago
Posts: 28
Topic starter  

ok, I can read the temperature via PC-USB (Windows 10).

thank you, milad.

Now I have to make sure that I control two SOLO via USB.

Kind regards
Osman

This post was modified 4 weeks ago by Osman

ReplyQuote
SOLO Team
(@milad)
Chief Member Moderator
Joined: 2 years ago
Posts: 251
 

@osman, great, and let me know if any problems or questions arose during your tests.

Milad

If you found the answers helpful and you could solve your problems, please kindly verify here to help others in the future.


ReplyQuote
Forum 1
(@osman)
Eminent Member
Joined: 7 months ago
Posts: 28
Topic starter  

@milad 

ok I can now control two solos via PC(Windows 10). You have to construct two objects and control each solo with an object.

Thank you Milad.

Kind regards
Osman


ReplyQuote
SOLO Team
(@milad)
Chief Member Moderator
Joined: 2 years ago
Posts: 251
 

Hi @osman,

Great job!

Yes exactly, the libraries of SOLO both for Python and also Arduino (C++) are written with object orientation in mind, so by just making multiple objects, you can have control over multiple SOLOs.

thanks for the update by the way.

Milad 

If you found the answers helpful and you could solve your problems, please kindly verify here to help others in the future.


ReplyQuote
Share: