machineagency / science-jubilee

Controlling Jubilees for Science!
https://science-jubilee.readthedocs.io/
MIT License
24 stars 10 forks source link

Unable to call on the Machine class #178

Closed jzhang-03 closed 2 weeks ago

jzhang-03 commented 3 weeks ago

Whilst I am able to import the Machine class, I am unable to call on it. My code currently is:

from science_jubilee.Machine import Machine
m = Machine()

The error this code is giving me is:

Warning: disconnecting this application from the network will halt connection to Jubilee.
Both `requests.post` and `requests.get` requests failed: HTTPConnectionPool(host='none', port=80): Max retries exceeded with url: /rr_model?key=seqs (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7fff642d5e50>: Failed to resolve 'none' ([Errno -2] Name or service not known)"))
Traceback (most recent call last):
  File "/home/robocop-99/science-jubilee/hello_world.py", line 3, in <module>
    m = Machine()
        ^^^^^^^^^
  File "/home/robocop-99/science-jubilee/src/science_jubilee/Machine.py", line 195, in __init__
    self.connect()
  File "/home/robocop-99/science-jubilee/src/science_jubilee/Machine.py", line 216, in connect
    response = json.loads(self.gcode('M409 K"move.axes[].homed"'))[
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/__init__.py", line 339, in loads
    raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not NoneType

The machine is connected over wireless WiFi (not Ethernet). It is running on a raspberry pi. The python version that is being used is 3.11.2 and the OS used is Linux 6.6.47.

I am able to operate the jubilee via Duet Web Control, however my goal is to be able to control the machine using python.

Prior to running my code, I didn't do anything but turn on the machine. The machine was not homed.

My current goal is trying to get the machine to simply move. Some help and guidance on resolving this issue would be greatly appreciated.

Thank you

jzhang-03 commented 2 weeks ago

The solution was

m = Machine(address = "duet 3")