Skip to content

Instantly share code, notes, and snippets.

@haixuanTao
Created November 5, 2024 06:08
Show Gist options
  • Save haixuanTao/3c4675372df4c71cff86be628a5eda79 to your computer and use it in GitHub Desktop.
Save haixuanTao/3c4675372df4c71cff86be628a5eda79 to your computer and use it in GitHub Desktop.
read piper data
from piper_sdk import *
piper_left = C_PiperInterface("can_left")
piper_left.ConnectPort()
piper_right = C_PiperInterface("can_right")
piper_right.ConnectPort()
joint_left = piper_left.GetArmJointMsgs()
joint_right = piper_right.GetArmJointMsgs()
factor = 57324.840764 #1000*180/3.14
joint_left_value = []
joint_left_value += [joint_left.joint_state.joint_0 / factor]
joint_left_value += [joint_left.joint_state.joint_1 / factor]
joint_left_value += [joint_left.joint_state.joint_2 / factor]
joint_left_value += [joint_left.joint_state.joint_3 / factor]
joint_left_value += [joint_left.joint_state.joint_4 / factor]
joint_left_value += [joint_left.joint_state.joint_5 / factor]
joint_left_value += [joint_left.joint_state.joint_6 / factor]
joint_right_value = []
joint_right_value += [joint_right.joint_state.joint_0 / factor]
joint_right_value += [joint_right.joint_state.joint_1 / factor]
joint_right_value += [joint_right.joint_state.joint_2 / factor]
joint_right_value += [joint_right.joint_state.joint_3 / factor]
joint_right_value += [joint_right.joint_state.joint_4 / factor]
joint_right_value += [joint_right.joint_state.joint_5 / factor]
joint_right_value += [joint_right.joint_state.joint_6 / factor]
print(joint_left_value)
print(joint_right_value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment