Common
common packages for kyubic
 
Loading...
Searching...
No Matches
joy_common.hpp
Go to the documentation of this file.
1
10#ifndef _JOY_COMMON_HPP
11#define _JOY_COMMON_HPP
12
13#include <joy_common_msgs/msg/buttons.hpp>
14#include <joy_common_msgs/msg/joy.hpp>
15#include <rclcpp/rclcpp.hpp>
16#include <sensor_msgs/msg/joy.hpp>
17#include <string>
18
19namespace joy_common
20{
21
22using ButtonValue = std::variant<bool, double>;
23using ButtonMap =
24 std::map<std::string, std::function<ButtonValue(const joy_common_msgs::msg::Buttons &)>>;
25
27
28class JoyCommon : public rclcpp::Node
29{
30public:
31 explicit JoyCommon(const rclcpp::NodeOptions & options);
32
33private:
34 std::string device_name;
35 double force_x_scale, force_y_scale, force_z_scale;
36 double torque_x_scale, torque_z_scale;
37
38 rclcpp::Publisher<joy_common_msgs::msg::Joy>::SharedPtr pub_;
39 rclcpp::Subscription<sensor_msgs::msg::Joy>::SharedPtr sub_;
40
41 void _joyCallback(const sensor_msgs::msg::Joy::SharedPtr msg);
42};
43
44} // namespace joy_common
45
46#endif // !_JOY_COMMON_HPP
Definition: joy_common.hpp:29
std::map< std::string, std::function< ButtonValue(const joy_common_msgs::msg::Buttons &)> > ButtonMap
Definition: joy_common.hpp:24
ButtonMap get_button_map()
Definition: joy_common.cpp:17
std::variant< bool, double > ButtonValue
Definition: joy_common.hpp:22