include
wiimote
teleop_wiimote.h
Go to the documentation of this file.
1
/*
2
* ROS Node for using a wiimote control unit to direct a robot.
3
* Copyright (c) 2016, Intel Corporation.
4
*
5
* This program is free software; you can redistribute it and/or modify it
6
* under the terms and conditions of the GNU General Public License,
7
* version 2, as published by the Free Software Foundation.
8
*
9
* This program is distributed in the hope it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
* more details.
13
*/
14
15
/*
16
* Initial C++ implementation by
17
* Mark Horn <mark.d.horn@intel.com>
18
*
19
* Revisions:
20
*
21
*/
22
23
#pragma once
24
#ifndef WIIMOTE_TELEOP_WIIMOTE_H
25
#define WIIMOTE_TELEOP_WIIMOTE_H
26
27
#include "
ros/ros.h
"
28
#include "sensor_msgs/Joy.h"
29
#include "wiimote/State.h"
30
31
#include <math.h>
32
33
// Sane defaults based on the TurtleBot
34
// TurtleBot maximum speed documented at 25.6"/second ~= 0.65024 m/s
35
#define DEFAULT_MAX_LINEAR_X 0.65024 // m/s
36
// TurtleBot maximum angular speed is documented at 180 degrees Pi / second
37
#define DEFAULT_MAX_ANGULAR_Z M_PI // rad/s
38
39
#define DEFAULT_PERCENT_LINEAR_THROTTLE 0.75
40
#define DEFAULT_PERCENT_ANGULAR_THROTTLE 0.75
41
42
class
TeleopWiimote
43
{
44
public
:
45
TeleopWiimote
();
46
47
private
:
48
void
rumbleFeedback
(
int
useconds);
49
void
setLEDFeedback
(
double
value);
50
void
joyCallback
(
const
sensor_msgs::Joy::ConstPtr& joy);
51
void
wiimoteStateCallback
(
const
wiimote::State::ConstPtr& wiistate);
52
53
double
linear_x_max_velocity_
;
// m/s
54
double
linear_x_min_velocity_
;
// m/s
55
double
angular_z_max_velocity_
;
// rad/s
56
double
angular_z_min_velocity_
;
// rad/s
57
58
double
percent_linear_throttle_
;
// 0.0 - 1.0 (1.0 = 100%)
59
double
percent_angular_throttle_
;
// 0.0 - 1.0 (1.0 = 100%)
60
61
ros::Publisher
vel_pub_
;
62
ros::Publisher
joy_pub_
;
63
ros::Subscriber
joy_sub_
;
64
ros::Subscriber
wiimote_sub_
;
65
66
bool
dpad_in_use_
=
false
;
67
bool
njoy_in_use_
=
false
;
68
};
69
70
#endif // WIIMOTE_TELEOP_WIIMOTE_H
TeleopWiimote::rumbleFeedback
void rumbleFeedback(int useconds)
Definition:
teleop_wiimote.cpp:169
ros::Publisher
TeleopWiimote::joy_pub_
ros::Publisher joy_pub_
Definition:
teleop_wiimote.h:62
ros.h
TeleopWiimote::vel_pub_
ros::Publisher vel_pub_
Definition:
teleop_wiimote.h:61
TeleopWiimote::percent_angular_throttle_
double percent_angular_throttle_
Definition:
teleop_wiimote.h:59
TeleopWiimote::setLEDFeedback
void setLEDFeedback(double value)
Definition:
teleop_wiimote.cpp:123
TeleopWiimote::linear_x_min_velocity_
double linear_x_min_velocity_
Definition:
teleop_wiimote.h:54
TeleopWiimote
Definition:
teleop_wiimote.h:42
TeleopWiimote::angular_z_max_velocity_
double angular_z_max_velocity_
Definition:
teleop_wiimote.h:55
TeleopWiimote::njoy_in_use_
bool njoy_in_use_
Definition:
teleop_wiimote.h:67
TeleopWiimote::percent_linear_throttle_
double percent_linear_throttle_
Definition:
teleop_wiimote.h:58
TeleopWiimote::wiimote_sub_
ros::Subscriber wiimote_sub_
Definition:
teleop_wiimote.h:64
TeleopWiimote::wiimoteStateCallback
void wiimoteStateCallback(const wiimote::State::ConstPtr &wiistate)
Definition:
teleop_wiimote.cpp:287
TeleopWiimote::joy_sub_
ros::Subscriber joy_sub_
Definition:
teleop_wiimote.h:63
TeleopWiimote::angular_z_min_velocity_
double angular_z_min_velocity_
Definition:
teleop_wiimote.h:56
TeleopWiimote::TeleopWiimote
TeleopWiimote()
Definition:
teleop_wiimote.cpp:29
TeleopWiimote::joyCallback
void joyCallback(const sensor_msgs::Joy::ConstPtr &joy)
Definition:
teleop_wiimote.cpp:190
TeleopWiimote::dpad_in_use_
bool dpad_in_use_
Definition:
teleop_wiimote.h:66
ros::Subscriber
TeleopWiimote::linear_x_max_velocity_
double linear_x_max_velocity_
Definition:
teleop_wiimote.h:53
wiimote
Author(s): Andreas Paepcke, Melonee Wise, Mark Horn
autogenerated on Thu Dec 5 2024 03:18:13