robotis_def.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 ################################################################################
5 # Copyright 2017 ROBOTIS CO., LTD.
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 # http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 ################################################################################
19 
20 # Author: Ryu Woon Jung (Leon)
21 
22 BROADCAST_ID = 0xFE # 254
23 MAX_ID = 0xFC # 252
24 
25 # Instruction for DXL Protocol
26 INST_PING = 1
27 INST_READ = 2
28 INST_WRITE = 3
29 INST_REG_WRITE = 4
30 INST_ACTION = 5
31 INST_FACTORY_RESET = 6
32 INST_SYNC_WRITE = 131 # 0x83
33 INST_BULK_READ = 146 # 0x92
34 # --- Only for 2.0 ---
35 INST_REBOOT = 8
36 INST_CLEAR = 16 #0x10
37 INST_STATUS = 85 # 0x55
38 INST_SYNC_READ = 130 # 0x82
39 INST_BULK_WRITE = 147 # 0x93
40 
41 # Communication Result
42 COMM_SUCCESS = 0 # tx or rx packet communication success
43 COMM_PORT_BUSY = -1000 # Port is busy (in use)
44 COMM_TX_FAIL = -1001 # Failed transmit instruction packet
45 COMM_RX_FAIL = -1002 # Failed get status packet
46 COMM_TX_ERROR = -2000 # Incorrect instruction packet
47 COMM_RX_WAITING = -3000 # Now recieving status packet
48 COMM_RX_TIMEOUT = -3001 # There is no status packet
49 COMM_RX_CORRUPT = -3002 # Incorrect status packet
50 COMM_NOT_AVAILABLE = -9000 #
51 
52 
53 # Macro for Control Table Value
54 def DXL_MAKEWORD(a, b):
55  return (a & 0xFF) | ((b & 0xFF) << 8)
56 
57 
58 def DXL_MAKEDWORD(a, b):
59  return (a & 0xFFFF) | (b & 0xFFFF) << 16
60 
61 
62 def DXL_LOWORD(l):
63  return l & 0xFFFF
64 
65 
66 def DXL_HIWORD(l):
67  return (l >> 16) & 0xFFFF
68 
69 
70 def DXL_LOBYTE(w):
71  return w & 0xFF
72 
73 
74 def DXL_HIBYTE(w):
75  return (w >> 8) & 0xFF


dynamixel_sdk
Author(s): Gilbert , Zerom , Darby Lim , Leon
autogenerated on Fri Apr 16 2021 02:25:55