z1_sdk/include/unitree_arm_sdk/control/ctrlComponents.h

37 lines
1.0 KiB
C
Raw Normal View History

2022-11-11 18:17:07 +08:00
#ifndef CTRLCOMPONENTS_H
#define CTRLCOMPONENTS_H
#include "unitree_arm_sdk/message/arm_common.h"
#include "unitree_arm_sdk/message/LowlevelCmd.h"
#include "unitree_arm_sdk/message/LowlevelState.h"
#include "unitree_arm_sdk/message/udp.h"
#include "unitree_arm_sdk/utilities/loop.h"
#include "unitree_arm_sdk/model/ArmModel.h"
2022-11-11 18:17:07 +08:00
2022-11-16 16:23:36 +08:00
namespace UNITREE_ARM {
2022-11-11 18:17:07 +08:00
struct CtrlComponents{
public:
2023-03-08 21:02:48 +08:00
CtrlComponents();
CtrlComponents(double deltaT, bool hasUnitreeGripper);
2022-11-11 18:17:07 +08:00
~CtrlComponents();
/*
* Function: send udp message to z1_ctrl and receive udp message from it
* Input: None
* Output: None
* Description: The function will call udp->send() to send datas in lowcmd to z1_ctrl
* and call udp->recv() to store datas from z1_ctrl into lowstate
*/
2022-11-11 18:17:07 +08:00
void sendRecv();
2023-05-25 21:04:18 +08:00
2022-11-11 18:17:07 +08:00
LowlevelCmd *lowcmd;
LowlevelState *lowstate;
double dt;// default: 0.002
SendCmd sendCmd; // udp command to control the arm
2022-11-11 18:17:07 +08:00
RecvState recvState; // the arm state receive from udp
ArmModel* armModel;
2023-03-08 21:02:48 +08:00
UDPPort *udp;
2022-11-11 18:17:07 +08:00
};
2022-11-16 16:23:36 +08:00
}
2022-11-11 18:17:07 +08:00
#endif