-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdxl_ax_12_example.py
27 lines (25 loc) · 972 Bytes
/
dxl_ax_12_example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import oscServer
import dxl_client_osc
'''
the aim of this code is to program the servo in readable way(clean page for control)
every dxl function has to be activated by Dispatcher exept port
'''
dxl_client_osc.portOpen()
#read position
oscServer.dispatch_callback("/readPosition",dxl_client_osc.positionRead)
#read load
oscServer.dispatch_callback("/readLoad",dxl_client_osc.loadRead)
#read temperature
oscServer.dispatch_callback("/readTemp",dxl_client_osc.tempRead)
#write torque
oscServer.dispatch_callback("/torque",dxl_client_osc.torqueEnable)
#write wheelmode
oscServer.dispatch_callback("/wheelMode",dxl_client_osc.wheelMode)
#write speed
oscServer.dispatch_callback("/writeSpeed",dxl_client_osc.servoSpeed)
#write goal position
oscServer.dispatch_callback("/writeGoalPos",dxl_client_osc.servoGoalPos)
#close port
oscServer.dispatch_callback("/closePort",dxl_client_osc.portClose)
#keep listening
oscServer.server_threading(oscServer.addr, oscServer.dispatcher)