This commit is contained in:
Emre Karatopuk 2024-11-07 20:25:46 +00:00 committed by GitHub
commit e9d0ce15f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 2 deletions

View File

@ -56,8 +56,17 @@ PYBIND11_MODULE(unitree_arm_interface, m){
.def("getGripperQ", &LowlevelState::getGripperQ, rvp::reference_internal)
;
py::class_<UDPPort>(m, "UDPPort")
.def(py::init<std::string, uint, uint>(),
py::arg("IP") = "127.0.0.1",
py::arg("toPort") = 8071,
py::arg("ownPort") = 8072
)
;
py::class_<CtrlComponents>(m, "CtrlComponents")
.def_readwrite("armModel", &CtrlComponents::armModel)
.def_readwrite("udp", &CtrlComponents::udp)
.def_readonly("dt", &CtrlComponents::dt)
;

View File

@ -8,6 +8,10 @@ np.set_printoptions(precision=3, suppress=True)
print("Press ctrl+\ to quit process.")
arm = unitree_arm_interface.ArmInterface(hasGripper=True)
ctrlComp = arm._ctrlComp
udp = unitree_arm_interface.UDPPort(IP = "127.0.0.1", toPort=8071, ownPort=8072)
ctrlComp.udp = udp
armState = unitree_arm_interface.ArmFSMState
arm.loopOn()

View File

@ -4,8 +4,10 @@ import unitree_arm_interface
import numpy as np
np.set_printoptions(precision=3, suppress=True)
arm = unitree_arm_interface.ArmInterface(hasGripper = True)
armModel = arm._ctrlComp.armModel
arm = unitree_arm_interface.ArmInterface(hasGripper=True)
ctrlComp = arm._ctrlComp
udp = unitree_arm_interface.UDPPort(IP = "127.0.0.1", toPort=8071, ownPort=8072)
ctrlComp.udp = udp
print('--------------------------FK & IK------------------------')
q_FORWARD = np.array([0, 1.5, -1, 0.54, 0, 0])