gusimplewhiteboard
HAL_HeadTarget.hpp
Go to the documentation of this file.
1
11#ifndef HAL_HeadTarget_DEFINED
12#define HAL_HeadTarget_DEFINED
13
14#include <sstream>
15
16#include "wb_hal_headtarget.h"
17
18namespace guWhiteboard
19{
41 {
42 public:
47
51 void Stop()
52 {
53 set_head_stopped(true);
54 set_head_cmd_mask(true);
55 }
56
63 void GoToWithTime(float yaw, float pitch, int time = 1000000)
64 {
65 GoToWithTime_rad(static_cast<float>(DEG2RAD(yaw)), static_cast<float>(DEG2RAD(pitch)), time);
66 }
67
74 void GoToWithTime_rad(float yaw, float pitch, int time = 1000000)
75 {
76/* if(yaw > float(DEG2RAD(YAW_LIMIT_POS)))
77 yaw = float(DEG2RAD(YAW_LIMIT_POS));
78 else if (yaw < float(DEG2RAD(YAW_LIMIT_NEG)))
79 yaw = float(DEG2RAD(YAW_LIMIT_NEG));
80
81 if(pitch > float(DEG2RAD(PITCH_LIMIT_POS)))
82 pitch = float(DEG2RAD(PITCH_LIMIT_POS));
83 else if (pitch < float(DEG2RAD(PITCH_LIMIT_NEG)))
84 pitch = float(DEG2RAD(PITCH_LIMIT_NEG));
85 */
86 set_target_pitchAngle(pitch);
87 set_target_yawAngle(yaw);
88 set_target_movement_time(time);
89 set_head_stopped(false);
90 set_head_cmd_mask(true);
91 }
92
93
94#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
99 HAL_HeadTarget(const std::string &str) { from_string(str); }
100
105 void from_string(const std::string &str)
106 {
107 fprintf(stderr, "NYI - Have it back: %s\n", const_cast<char *>(str.c_str()));
108 }
109
114 std::string description() const
115 {
116 std::stringstream ss;
117 ss << target_pitchAngle() << " P, " << target_yawAngle() << " Y, " << target_movement_time() << " T, " << head_stopped() << " S, " << head_cmd_mask() << " M";
118 return ss.str();
119 }
120#endif // WHITEBOARD_POSTER_STRING_CONVERSION
121 };
122}
123
124#endif //HAL_HeadTarget_DEFINED
Class for moving a robotic head in abs coords.
std::string description() const
Description method for pretty printing the values in this class.
void GoToWithTime(float yaw, float pitch, int time=1000000)
move to position in degrees over a given time
HAL_HeadTarget(const std::string &str)
String constructor (NYI)
void GoToWithTime_rad(float yaw, float pitch, int time=1000000)
move to position in radians over a given time
void from_string(const std::string &str)
Parser for recreating this class (NYI)
void Stop()
Set stopping vars.
/file APM_Interface.h
HAL_HeadTarget c struct.