2 #ifndef _GAMS_PLATFORM_OSC_JOYSTICK_PLATFORM_H_
3 #define _GAMS_PLATFORM_OSC_JOYSTICK_PLATFORM_H_
9 #include "madara/knowledge/KnowledgeBase.h"
10 #include "madara/knowledge/containers/NativeDoubleVector.h"
11 #include "madara/utility/EpochEnforcer.h"
12 #include "madara/utility/Timer.h"
23 namespace gams {
namespace platforms
29 class GAMS_EXPORT OscJoystickPlatform :
public BasePlatform
35 MOVEMENT_STOP_ON_ARRIVAL = 0,
36 MOVEMENT_PASSTHROUGH = 1
46 madara::knowledge::KnowledgeBase * knowledge = 0,
49 const std::string & type =
"quadcopter");
54 virtual ~OscJoystickPlatform();
60 virtual int sense(
void)
override;
66 virtual int analyze(
void)
override;
71 virtual std::string get_name()
const override;
79 virtual std::string get_id()
const override;
85 virtual double get_accuracy(
void)
const override;
91 virtual double get_min_sensor_range(
void)
const override;
97 virtual double get_move_speed(
void)
const override;
103 virtual int home(
void)
override;
109 virtual int land(
void)
override;
117 int move(
const pose::Position & location,
118 const pose::PositionBounds &bounds)
override;
129 const pose::OrientationBounds &bounds)
override;
136 virtual void pause_move(
void)
override;
142 virtual void set_move_speed(
const double& speed)
override;
148 virtual void stop_move(
void)
override;
154 virtual int takeoff(
void)
override;
165 void build_prefixes(
void);
175 std::vector<double> calculate_thrust(
176 const pose::Position & current,
const pose::Position & target,
180 gams::utility::OscUdp osc_;
183 madara::transport::QoSTransportSettings settings_;
186 std::string xy_velocity_prefix_;
189 std::string z_velocity_prefix_;
192 std::string yaw_velocity_prefix_;
195 std::string position_prefix_;
198 std::string rotation_prefix_;
201 bool is_created_ =
false;
204 std::string json_creation_;
207 pose::Position last_move_;
213 madara::utility::Timer<madara::utility::Clock> move_timer_;
216 madara::utility::Timer<madara::utility::Clock> last_thrust_timer_;
219 madara::utility::Timer<madara::utility::Clock> last_position_timer_;
225 double loiter_timeout_;
228 std::string event_fd_;
240 madara::knowledge::containers::NativeDoubleVector xyz_velocity_;
243 madara::threads::Threader threader_;
251 class GAMS_EXPORT OscJoystickPlatformFactory :
public PlatformFactory
260 OscJoystickPlatformFactory(
const std::string & type =
"quadcopter");
265 virtual ~OscJoystickPlatformFactory();
281 virtual BasePlatform * create(
282 const madara::knowledge::KnowledgeMap & args,
283 madara::knowledge::KnowledgeBase * knowledge,
286 variables::Self *
self);
Copyright (c) 2019 James Edmondson.
Copyright(c) 2014 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
Provides Reference Frame (i.e., coordinate systemm) transforms.
A container for self referencing information.
gams::pose::Orientation Orientation
Represents a orientation or orientation within a reference frame.
std::map< std::string, PlatformStatus > Platforms
a map of sensor names to the sensor information
std::map< std::string, Sensor * > Sensors
a map of sensor names to the sensor information
Contains all GAMS-related tools, classes and code.
Copyright (c) 2015 Carnegie Mellon University.