z1_sdk/include/unitree_arm_sdk/joystick.h

39 lines
892 B
C
Raw Normal View History

2022-07-20 11:20:01 +08:00
#ifndef _UNITREE_ARM_JOYSTICK_H_
#define _UNITREE_ARM_JOYSTICK_H_
#include <vector>
#include "unitree_arm_sdk/udp.h"
#include "unitree_arm_sdk/cmdPanel.h"
#include "unitree_arm_sdk/common/joystick_common.h"
2022-09-13 19:52:44 +08:00
#define CTRL_BY_ALIENGO_JOYSTICK
#ifdef CTRL_BY_ALIENGO_JOYSTICK
#include "unitree_arm_sdk/common/aliengo_common.h"
#else
#include "unitree_arm_sdk/common/b1_common.h"
#endif
2022-07-20 11:20:01 +08:00
using namespace UNITREE_LEGGED_SDK;
class UnitreeJoystick : public CmdPanel{
public:
UnitreeJoystick(std::vector<KeyAction*> events,
EmptyAction emptyAction, size_t channelNum = 1,
double dt = 0.002);
~UnitreeJoystick();
SendCmd getSendCmd(){return _sendCmd;};
2022-07-20 11:20:01 +08:00
private:
SendCmd _sendCmd;
2022-07-20 11:20:01 +08:00
void _read();
void _extractCmd();
xRockerBtnDataStruct _keyData;
UDPPort *_udp;
HighCmd _udpCmd;
HighState _udpState;
};
#endif // _UNITREE_ARM_JOYSTICK_H_