Fawkes API Fawkes Development Version
joystick_teleop_thread.h
1
2/***************************************************************************
3 * joystick_teleop_thread.h - Joystick teleop thread
4 *
5 * Created: Sun Nov 13 23:22:29 2011 (as part of the robotino plugin)
6 * Copyright 2011-2014 Tim Niemueller [www.niemueller.de]
7 ****************************************************************************/
8
9/* This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Library General Public License for more details.
18 *
19 * Read the full text in the LICENSE.GPL file in the doc directory.
20 */
21
22#ifndef _PLUGINS_JOYSTICK_JOYSTICK_TELEOP_THREAD_H_
23#define _PLUGINS_JOYSTICK_JOYSTICK_TELEOP_THREAD_H_
24
25#include <aspect/blackboard.h>
26#include <aspect/blocked_timing.h>
27#include <aspect/configurable.h>
28#include <aspect/logging.h>
29#include <core/threading/thread.h>
30
31#include <cfloat>
32#include <string>
33
34namespace fawkes {
35class MotorInterface;
36class JoystickInterface;
37class Laser360Interface;
38} // namespace fawkes
39
45{
46public:
48
49 virtual void init();
50 virtual void loop();
51 virtual bool prepare_finalize_user();
52 virtual void finalize();
53
54 /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
55protected:
56 virtual void
58 {
59 Thread::run();
60 }
61
62private:
63 void stop();
64 bool is_area_free(float theta);
65 void send_transrot(float vx, float vy, float omega);
66
67private:
68 fawkes::MotorInterface * motor_if_;
69 fawkes::JoystickInterface *joystick_if_;
71
72 unsigned int cfg_axis_forward_;
73 unsigned int cfg_axis_sideward_;
74 unsigned int cfg_axis_rotation_;
75 float cfg_axis_threshold_;
76 bool cfg_deadman_use_axis_;
77 unsigned int cfg_deadman_axis_;
78 float cfg_deadman_ax_thresh_;
79 unsigned int cfg_deadman_butmask_;
80 bool cfg_drive_mode_use_axis_;
81 unsigned int cfg_drive_mode_axis_;
82 float cfg_drive_mode_ax_thresh_;
83 unsigned int cfg_drive_mode_butmask_;
84 float cfg_normal_max_vx_;
85 float cfg_normal_max_vy_;
86 float cfg_normal_max_omega_;
87 float cfg_special_max_vx_;
88 float cfg_special_max_vy_;
89 float cfg_special_max_omega_;
90 bool cfg_collision_safety_;
91 float cfg_collision_safety_distance_;
92 unsigned int cfg_collision_safety_angle_;
93 std::string cfg_ifid_motor_;
94 std::string cfg_ifid_joystick_;
95 bool cfg_use_laser_;
96 std::string cfg_ifid_laser_;
97 bool cfg_use_ff_;
98 unsigned int cfg_runstop_enable_buttons_;
99 unsigned int cfg_runstop_disable_buttons_;
100
101 bool stopped_;
102 float min_distance_;
103
104 bool ff_weak_;
105 bool ff_strong_;
106
107 bool runstop_pressed_;
108};
109
110#endif
Remotely control a robot using a joystick.
virtual void run()
Stub to see name in backtrace for easier debugging.
virtual void init()
Initialize the thread.
virtual bool prepare_finalize_user()
Prepare finalization user implementation.
virtual void loop()
Code to execute in the thread.
virtual void finalize()
Finalize the thread.
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
Thread aspect to use blocked timing.
Thread aspect to access configuration data.
Definition: configurable.h:33
JoystickInterface Fawkes BlackBoard Interface.
Laser360Interface Fawkes BlackBoard Interface.
Thread aspect to log output.
Definition: logging.h:33
MotorInterface Fawkes BlackBoard Interface.
Thread class encapsulation of pthreads.
Definition: thread.h:46
Fawkes library namespace.