joystick header added
This commit is contained in:
parent
c57c81290c
commit
2bdb5671ee
|
@ -0,0 +1,44 @@
|
|||
/*****************************************************************
|
||||
Copyright (c) 2020, Unitree Robotics.Co.Ltd. All rights reserved.
|
||||
*****************************************************************/
|
||||
#ifndef _UNITREE_LEGGED_JOYSTICK_H_
|
||||
#define _UNITREE_LEGGED_JOYSTICK_H_
|
||||
|
||||
#include <stdint.h>
|
||||
// 16b
|
||||
typedef union {
|
||||
struct {
|
||||
uint8_t R1 : 1;
|
||||
uint8_t L1 : 1;
|
||||
uint8_t start : 1;
|
||||
uint8_t select : 1;
|
||||
uint8_t R2 : 1;
|
||||
uint8_t L2 : 1;
|
||||
uint8_t F1 : 1;
|
||||
uint8_t F2 : 1;
|
||||
uint8_t A : 1;
|
||||
uint8_t B : 1;
|
||||
uint8_t X : 1;
|
||||
uint8_t Y : 1;
|
||||
uint8_t up : 1;
|
||||
uint8_t right : 1;
|
||||
uint8_t down : 1;
|
||||
uint8_t left : 1;
|
||||
} components;
|
||||
uint16_t value;
|
||||
} xKeySwitchUnion;
|
||||
|
||||
// 40 Byte (now used 24B)
|
||||
typedef struct {
|
||||
uint8_t head[2];
|
||||
xKeySwitchUnion btn;
|
||||
float lx;
|
||||
float rx;
|
||||
float ry;
|
||||
float L2;
|
||||
float ly;
|
||||
|
||||
uint8_t idle[16];
|
||||
} xRockerBtnDataStruct;
|
||||
|
||||
#endif // _UNITREE_LEGGED_JOYSTICK_H_
|
|
@ -22,6 +22,7 @@
|
|||
#include "unitree_go/msg/sport_mode_state.hpp"
|
||||
#include "unitree_api/msg/request.hpp"
|
||||
#include "common/ros2_sport_client.h"
|
||||
#include "joystick.h"
|
||||
|
||||
class Custom: public rclcpp::Node
|
||||
{
|
||||
|
@ -79,6 +80,7 @@ class Custom: public rclcpp::Node
|
|||
rclcpp::Publisher<unitree_go::msg::LowCmd>::SharedPtr lowcmd_puber;
|
||||
unitree_go::msg::LowCmd lowcmd_msg;
|
||||
uint64_t last_lowcmd_stamp = 0;
|
||||
xRockerBtnDataStruct _keyData;
|
||||
|
||||
void init_lowcmd()
|
||||
{
|
||||
|
|
|
@ -1 +1 @@
|
|||
source /ros2_ws/install/setup.bash && ros2 launch /root/launch/hw.launch.py
|
||||
source /dock_ws/install/setup.bash && ros2 launch /root/launch/hw.launch.py
|
Loading…
Reference in New Issue