RoboDK Forum
无法连接到AT960 pythonn激光跟踪器et- Printable Version

+- RoboDK Forum (//www.sinclairbody.com/forum)
+-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN)
+--- Forum: RoboDK bugs (//www.sinclairbody.com/forum/Forum-RoboDK-bugs)
+--- Thread: UNABLE TO CONNECT TO AT960 LASER TRACKER - pythonnet (/Thread-UNABLE-TO-CONNECT-TO-AT960-LASER-TRACKER-pythonnet)

Pages: 1 2


无法连接到AT960 pythonn激光跟踪器et-sig.johnnson-02-23-2023

I am not able to connect to an AT960 Laser Tracker using the RoboDK GUI.

When I click "Connect" in the "Laser Tracker System" pane, I get the following message in the "Laser Tracker Status log":

Quote:Laser Tracker status
Not connected
Stopped
Starting...
Working...
:: ID = BF2DCC56-B02A-B19F-C8E3-F09A91CD6196, Len = 128
:: ID = BF2DCC56-B02A-B19F-C8E3-F09A91CD6196, Len = 84
:: ID = BF2DCC56-B02A-B19F-C8E3-F09A91CD6196, Len = 84
RoboDK Driver for Leica Tracker Pilot - v4.0.0
Use one of the simulator trackers for testing the driver in RoboDK:
IP: at960simulator
IP: ats600simulator
IP: ats402simulator
Important: You may need to select Command-Initialize to start the tracker for some trackers
Command INIT: Initialize tracker
Command GETR: Get reflectors
Command STATUS: Tracker status
Command LOCK: Lock tracker on target
Command UNLOCK: Unloadk tracker
Command SAMPLES 100: 100 samples per measurement
Command SAMPLES 500: 500 samples per measurement
Command SAMPLES 1000: 1000 samples per measurement
Command SETR 0: Set reflector 0
Command SETR 1: Set reflector 1
Command SETR 2: Set reflector 2
Command SETR 3: Set reflector 3
Command SETR 4: Set reflector 4
Command SETR 5: Set reflector 5
Command SETR 6: Set reflector 6
Command SETR 7: Set reflector 7
Command SETR 8: Set reflector 8
Tracker not connected
Working...
Connecting to tracker: 192.168.0.99
Working...
:: ID = BF2DCC56-B02A-B19F-C8E3-F09A91CD6196, Len = 128
:: ID = BF2DCC56-B02A-B19F-C8E3-F09A91CD6196, Len = 84
:: ID = BF2DCC56-B02A-B19F-C8E3-F09A91CD6196, Len = 84
Unexpected error: Traceback (most recent call last):
Unexpected error: File "C:/RoboDK/api/Leica/LeicaTrackerPilot.py", line 206, in RunDriver
Unexpected error: RunCommand(LISTCMD.pop(0))
Unexpected error: File "C:/RoboDK/api/Leica/LeicaTrackerPilot.py", line 280, in RunCommand
Unexpected error: if TrackerConnect():
Unexpected error: File "C:/RoboDK/api/Leica/LeicaTrackerPilot.py", line 501, in TrackerConnect
Unexpected error: return ConnectToTracker(Tracker_IP)
Unexpected error: File "C:/RoboDK/api/Leica/LeicaTrackerPilot.py", line 689, in ConnectToTracker
Unexpected error: connectedTracker.Settings.Units.LengthUnit = EnumMeter
Unexpected error: TypeError: since Python.NET 3.0 int can not be converted to Enum implicitly. Use Enum(int_value)
since Python.NET 3.0 int can not be converted to Enum implicitly. Use Enum(int_value)
Tracker error



RE: UNABLE TO CONNECT TO AT960 LASER TRACKER-Sam-02-23-2023

I think pythonnet released a major version and the batch script doesn't take version range into account.
Can you try with pythonnet 2.5.2 or earlier?

C:\RoboDK\Python37\python.exe -m pip install pythonnet==2.5.2

I'll check with Albert for the specific version, and we will ensure it is working with the latest version too.


RE: UNABLE TO CONNECT TO AT960 LASER TRACKER-sig.johnnson-02-23-2023

Hi Jeremy,

That solved the problem. Thanks!


RE: UNABLE TO CONNECT TO AT960 LASER TRACKER-sig.johnnson-03-07-2023

Sam,

I am reopening this thread because I encountered another issue (on a different machine) when attempting to apply this fix.

Code:
C:\RoboDK\Python311>python.exe -m pip install pythonnet==2.5.2
收集pythonnet = = 2.5.2
Using cached pythonnet-2.5.2.tar.gz (1.9 MB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: pycparser in c:\robodk\python311\lib\site-packages (from pythonnet==2.5.2) (2.21)
Installing collected packages: pythonnet
DEPRECATION: pythonnet is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for pythonnet ... error
error: subprocess-exited-with-error

× Running setup.py install for pythonnet did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help

error: option --single-version-externally-managed not recognized
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pythonnet

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

[notice] A new release of pip available: 22.3.1 -> 23.0.1
[notice] To update, run: python.exe -m pip install --upgrade pip

C:\RoboDK\Python311>echo DONE
DONE

C:\RoboDK\Python311>pause
Press any key to continue . . .

This new machine runs Python 3.11.1, which I believe caused the issue.

I would like to continue using 3.11.1 because all my other code is written for 3.11.1 and match case is awesome. Is there a workaround for this besides switching Python versions to 3.7.3?


RE: UNABLE TO CONNECT TO AT960 LASER TRACKER-Albert-03-07-2023

Did you try installing the latest version of Pythonnet?

Just remove the version from the install command:
Code:
python.exe -m pip install pythonnet



RE: UNABLE TO CONNECT TO AT960 LASER TRACKER - pythonnet-Sam-03-07-2023

As specified on PyPI, pythonnet 2.5.2 only goes up to Python 3.8:
https://pypi.org/project/pythonnet/2.5.2/

I tested with pythonnet 3.0.1 this morning on Python 3.11 and did not get the crash in the driver.
Using pip freeze, I am using
clr-loader==0.2.5
cffi==1.15.1
pycparser==2.21


RE: UNABLE TO CONNECT TO AT960 LASER TRACKER - pythonnet-sig.johnnson-03-07-2023

Code:
C:\Users\xxx>pip list
Package Version
--------------- -------
attrs 22.2.0
cffi 1.15.1
clr 1.0.3
clr-loader 0.2.5
colorama 0.4.6
contourpy 1.0.6
cycler 0.11.0
dill 0.3.6
fonttools 4.38.0
iniconfig 1.1.1
joblib 1.2.0
kiwisolver 1.4.4
numpy 1.24.1
packaging 22.0
pandas 1.5.2
Pillow 9.4.0
pip 22.3.1
pluggy 1.0.0
POAP 0.1.26
psutil 5.9.4
pycparser 2.21
pyDOE2 1.3.0
pyparsing 3.0.9
pySOT 0.3.3
pySW 1.4
pytest 7.2.0
python-dateutil 2.8.2
pythonnet 3.0.1
pytz 2022.7
pywin32 305
scikit-learn 1.2.0
scipy 1.10.0
setuptools 65.5.0
six 1.16.0
threadpoolctl 3.1.0

[notice] A new release of pip available: 22.3.1 -> 23.0.1
[notice] To update, run: python.exe -m pip install --upgrade pip


Albert, I tried removing the version from the .bat and still have this issue.

Sam, it looks like I have the same versions as you, but unfortunately, I am still encountering this problem.


RE: UNABLE TO CONNECT TO AT960 LASER TRACKER - pythonnet-Sam-03-07-2023

The Leica driver that ships with the RoboDK installer is more recent than the one//www.sinclairbody.com/downloads/private/Leica.zip.
Albert will update the link soon, but you can install update RoboDK in the meantime to get the latest version (located in C:\RoboDK\api\Leica).


RE: UNABLE TO CONNECT TO AT960 LASER TRACKER - pythonnet-sig.johnnson-03-07-2023

I downloaded a new version of RoboDK and grabbed the .bat, .dll, and .py out of the api/leica folder. This changed what error I was getting, but did not resolve it:

Stopped
Starting...
Working...
module 'clr' has no attribute 'AddReference'
Manually run the following file using Administrator Privileges: C:/RoboDK/api/Leica/Install-Pythonnet.bat
Installation not complete, check Log
Stopped


RE: UNABLE TO CONNECT TO AT960 LASER TRACKER - pythonnet-Sam-03-08-2023

Email us at info@www.sinclairbody.com and ask to get in touch with me, citing this forum thread.