线程Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

RoboDK定制的司机

#1
Hello,

I have coded a custom driver for RoboDK to connect to Arduino. From RoboDK GUI, connection works and I am able to send commands (from buttons & program) without any issue.

Though, when I want to use Python API and callsetConnectionParamsmethod, I get the error below.
Code:
File "/venv/lib/python3.7/site-packages/robolink/robolink.py", line 4017, in setConnectionParams
self.link._check_status()
File "/venv/lib/python3.7/site-packages/robolink/robolink.py", line 363, in _check_status
raise Exception('Problems running function')
Exception: Problems running function

Here is the connect function from my custom driver:
Code:
def connect(self, host: str, baudrate: int):
if not self._connected:
try:
self._serial = serial.Serial(host, baudrate=baudrate, timeout=0.5)
except serial.serialutil.SerialException:
self._robodk.update_status(1)
return

self._connected = self._serial.is_open

if self._connected:
self._robodk.update_status(4) # Ready
else:
self._robodk.update_status(1) # Connection problems

# ----- #

def print_message(self, message):
print('SMS:' + message)
sys.stdout.flush()

def update_status(self, status):
if status in ROBOTCOM_STATUS:
status = ROBOTCOM_STATUS[status]

self.print_message('{status}'.format(status=status))

This seems to happen during setting of params. Thus, I am kinda lost where to start debugging. Any help is much appreciated.


Messages In This Thread
RoboDK定制的司机 - byniekas- 05-09-2019, 03:18 PM
RE: RoboDK Custom Driver - byAlbert- 05-09-2019, 11:30 PM
RE: RoboDK Custom Driver - byniekas- 05-10-2019, 07:18 AM
RE: RoboDK Custom Driver - byniekas上午11 - 05-19-2019,
RE: RoboDK Custom Driver - byAlbert- 05-20-2019, 07:12 PM



Users browsing this thread:
1 Guest(s)