Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions dxl2/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ class Instruction(Enum):
Instruction.MODEL_NUMBER_H: [1],
Instruction.MODEL_NUMBER: [1, 0],
Instruction.TORQUE_ENABLE: [24],
Instruction.GOAL_POSITION: [31, 30],
Instruction.MOVING_SPEED: [33, 32],
Instruction.PRESENT_POSITION: [37, 36],
Instruction.GOAL_POSITION: [30, 31],
Instruction.MOVING_SPEED: [32, 33],
Instruction.PRESENT_POSITION: [36, 37],
}

MX: Dict[Instruction, List[int]] = {
Instruction.MODEL_NUMBER_L: [0],
Instruction.MODEL_NUMBER_H: [1],
Instruction.MODEL_NUMBER: [1, 0],
Instruction.TORQUE_ENABLE: [24],
Instruction.GOAL_POSITION: [31, 30],
Instruction.MOVING_SPEED: [33, 32],
Instruction.PRESENT_POSITION: [37, 36],
Instruction.GOAL_POSITION: [30, 31],
Instruction.MOVING_SPEED: [32, 33],
Instruction.PRESENT_POSITION: [36, 37],
}
12 changes: 11 additions & 1 deletion dxl2/util.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import dynamixel_sdk as sdk

from dynamixel_sdk import DXL_LOBYTE, DXL_LOWORD, DXL_HIBYTE, DXL_HIWORD


Expand All @@ -21,3 +20,14 @@ def create2ByteArray(bin_value):
def create1ByteArray(bin_value):
byte_array = [DXL_LOBYTE(DXL_LOWORD(bin_value))]
return byte_array


def angleAX(val):
agl = int(512 + (val/0.29))
if(agl>1023):
return 1023
elif(agl<0):
return 0
else:
return agl