You can read the story behind the project here.
RoboDK's explanation on robot drivers can be found over here. Making your own RoboDK robot driver lets you control your own robot mechanisms.
-
Install library
pip install robodkdriver
-
Create a python file in RoboDK driver directory
-
Import module
from robodkdriver import RoboDK, RobotSerial
-
Extend
RobotSerial
classclass MyOneAxisRobot(RobotSerial): def run_command(self, cmd: str, args: tuple): RoboDK.update_status('working') if cmd == 'CONNECT': connected = self._connect(port=args[0], baud_rate=int(args[1])) if not connected: return 'connection_problems' return 'ready' if cmd == 'DISCONNECT' or cmd == 'STOP': disconnected = self._disconnect() if disconnected: return 'disconnected' return 'ready' if cmd == 'MOVJ': self._send_message('{cmd} {angle}'.format(cmd=cmd, angle=args[0])) if self._get_message('DONE'): return 'ready' return 'error' if cmd == 'CJNT': self._send_message(cmd) joints = self._get_message() RoboDK.update_status(joints) return 'ready' ...
You need to define how robot should act accordingly to each RoboDK command. You can return:
- ready: when robot is ready for new command
- working: when robot starts working
- waiting: when robot is waiting
- disconnected: when robot is disconnected
- not_connected: when robot is not connected
- connection_problems: when there are connection problems
-
Start driver
if __name__ == '__main__': RoboDK(MyOneAxisRobot()).run_driver()
-
Change configuration on RoboDK robot connection
- RobotSocket Class
- Better getting started
- More info on how RoboDK driver communicates