27 #include "ardrone_autonomy/LedAnim.h" 28 #include "utils/ardrone_date.h" 53 BLINK_GREEN_RED, BLINK_GREEN, BLINK_RED, BLINK_ORANGE,
54 SNAKE_GREEN_RED, FIRE, STANDARD, RED, GREEN, RED_SNAKE, BLANK,
55 LEFT_GREEN_RIGHT_RED, LEFT_RED_RIGHT_GREEN, BLINK_STANDARD
60 ardrone_autonomy::CamSelect::Response& response)
62 const int _modes = (IS_ARDRONE1) ? 4 : 2;
65 fprintf(stderr,
"\nSetting camera channel to : %d.\n",
cam_state);
66 response.result =
true;
71 std_srvs::Empty::Response& response)
73 const int _modes = (IS_ARDRONE1) ? 4 : 2;
76 fprintf(stderr,
"\nSetting camera channel to : %d.\n",
cam_state);
82 ardrone_autonomy::RecordEnable::Response& response)
84 char record_command[ARDRONE_DATE_MAXSIZE + 64];
87 if (request.enable ==
true)
89 char date[ARDRONE_DATE_MAXSIZE];
90 time_t t = time(NULL);
93 strftime(date, ARDRONE_DATE_MAXSIZE, ARDRONE_FILE_DATE_FORMAT, localtime(&t));
94 snprintf(record_command,
sizeof(record_command),
"%d,%s", USERBOX_CMD_START, date);
95 new_codec = MP4_360P_H264_720P_CODEC;
99 snprintf(record_command,
sizeof(record_command),
"%d", USERBOX_CMD_STOP);
100 new_codec = H264_360P_CODEC;
108 response.result =
true;
113 ardrone_autonomy::LedAnim::Response& response)
115 LED_ANIMATION_IDS anim_id =
ledAnimMap[request.type % 14];
117 ardrone_at_set_led_animation(anim_id,
118 static_cast<float>(fabs(request.freq)),
119 static_cast<uint32_t>(abs(request.duration)));
121 response.result =
true;
126 ardrone_autonomy::FlightAnim::Response &response)
129 const int anim_type = request.type % ARDRONE_NB_ANIM_MAYDAY;
130 const int anim_duration = (request.duration > 0) ? request.duration : MAYDAY_TIMEOUT[anim_type];
131 snprintf(param,
sizeof(param),
"%d,%d", anim_type, anim_duration);
135 response.result =
true;
140 std_srvs::Empty::Response &response)
143 ardrone_at_set_flat_trim();
145 fprintf(stderr,
"\nFlat Trim Set.\n");
152 cmd_vel.linear.x = std::max(std::min(-msg->linear.x, 1.0), -1.0);
153 cmd_vel.linear.y = std::max(std::min(-msg->linear.y, 1.0), -1.0);
154 cmd_vel.linear.z = std::max(std::min(msg->linear.z, 1.0), -1.0);
155 cmd_vel.angular.z = std::max(std::min(-msg->angular.z, 1.0), -1.0);
158 cmd_vel.angular.x = msg->angular.x;
159 cmd_vel.angular.y = msg->angular.y;
196 ardrone_tool_set_ui_pad_select(1);
201 ardrone_tool_set_ui_pad_start(1);
206 ardrone_tool_set_ui_pad_start(0);
211 float left_right =
static_cast<float>(
cmd_vel.linear.y);
212 float front_back =
static_cast<float>(
cmd_vel.linear.x);
213 float up_down =
static_cast<float>(
cmd_vel.linear.z);
214 float turn =
static_cast<float>(
cmd_vel.angular.z);
226 int32_t control_flag = 0x00;
227 int32_t combined_yaw = 0x00;
230 int32_t hover = (int32_t)
232 (fabs(left_right) <
_EPS) &&
233 (fabs(front_back) <
_EPS) &&
234 (fabs(up_down) <
_EPS) &&
235 (fabs(turn) <
_EPS) &&
241 control_flag |= ((1 - hover) << 0);
242 control_flag |= (combined_yaw << 1);
250 if ((is_changed) || (hover))
252 ardrone_tool_set_progressive_cmd(control_flag, left_right, front_back, up_down, turn, 0.0, 0.0);
bool ToggleCamCallback(std_srvs::Empty::Request &request, std_srvs::Empty::Response &response)
void ResetCallback(const std_msgs::Empty &msg)
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val)
C_RESULT open_teleop(void)
bool SetCamChannelCallback(ardrone_autonomy::CamSelect::Request &request, ardrone_autonomy::CamSelect::Response &response)
void LandCallback(const std_msgs::Empty &msg)
#define DEFAULT_CAM_STATE
const LED_ANIMATION_IDS ledAnimMap[14]
bool SetFlightAnimationCallback(ardrone_autonomy::FlightAnim::Request &request, ardrone_autonomy::FlightAnim::Response &response)
C_RESULT close_teleop(void)
int set_navdata_demo_value
#define DEFAULT_NAVDATA_DEMO
C_RESULT update_teleop(void)
bool FlatTrimCallback(std_srvs::Empty::Request &request, std_srvs::Empty::Response &response)
bool SetRecordCallback(ardrone_autonomy::RecordEnable::Request &request, ardrone_autonomy::RecordEnable::Response &response)
int32_t detect_enable_placeholder
ARDRONE_TOOL_CONFIGURATION_ADDEVENT(profile_id, buffer, NULL)
bool SetLedAnimationCallback(ardrone_autonomy::LedAnim::Request &request, ardrone_autonomy::LedAnim::Response &response)
void CmdVelCallback(const geometry_msgs::TwistConstPtr &msg)
int32_t detect_enemy_color
int32_t detect_disable_placeholder
int32_t detect_indoor_hull
geometry_msgs::Twist cmd_vel
void TakeoffCallback(const std_msgs::Empty &msg)