support turning on and off usb stick recording
Esse commit está contido em:
@@ -27,6 +27,7 @@ ARDroneDriver::ARDroneDriver()
|
|||||||
setLedAnimation_service = node_handle.advertiseService("ardrone/setledanimation", setLedAnimationCallback);
|
setLedAnimation_service = node_handle.advertiseService("ardrone/setledanimation", setLedAnimationCallback);
|
||||||
flatTrim_service = node_handle.advertiseService("ardrone/flattrim", flatTrimCallback);
|
flatTrim_service = node_handle.advertiseService("ardrone/flattrim", flatTrimCallback);
|
||||||
setFlightAnimation_service = node_handle.advertiseService("ardrone/setflightanimation", setFlightAnimationCallback);
|
setFlightAnimation_service = node_handle.advertiseService("ardrone/setflightanimation", setFlightAnimationCallback);
|
||||||
|
setRecord_service = node_handle.advertiseService("ardrone/setrecord", setRecordCallback );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
To be honest, I am not sure why advertising a service using class members should be this complicated!
|
To be honest, I am not sure why advertising a service using class members should be this complicated!
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ private:
|
|||||||
ros::ServiceServer imuReCalib_service;
|
ros::ServiceServer imuReCalib_service;
|
||||||
ros::ServiceServer flatTrim_service;
|
ros::ServiceServer flatTrim_service;
|
||||||
ros::ServiceServer setFlightAnimation_service;
|
ros::ServiceServer setFlightAnimation_service;
|
||||||
|
ros::ServiceServer setRecord_service;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Orange Green : 1
|
* Orange Green : 1
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "teleop_twist.h"
|
#include "teleop_twist.h"
|
||||||
#include "ardrone_autonomy/LedAnim.h"
|
#include "ardrone_autonomy/LedAnim.h"
|
||||||
|
#include "utils/ardrone_date.h"
|
||||||
|
|
||||||
inline float max(float a, float b) { return a > b ? a : b; }
|
inline float max(float a, float b) { return a > b ? a : b; }
|
||||||
inline float min(float a, float b) { return a < b ? a : b; }
|
inline float min(float a, float b) { return a < b ? a : b; }
|
||||||
@@ -48,6 +49,34 @@ bool toggleCamCallback(std_srvs::Empty::Request& request, std_srvs::Empty::Respo
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ros service callback to turn on and off camera recording
|
||||||
|
bool setRecordCallback(ardrone_autonomy::RecordEnable::Request &request, ardrone_autonomy::RecordEnable::Response& response)
|
||||||
|
{
|
||||||
|
char record_command[ARDRONE_DATE_MAXSIZE + 64];
|
||||||
|
int32_t new_codec;
|
||||||
|
|
||||||
|
if( request.enable == true ) {
|
||||||
|
char date[ARDRONE_DATE_MAXSIZE];
|
||||||
|
time_t t = time(NULL);
|
||||||
|
// For some reason the linker can't find this, so we'll just do it manually, cutting and pasting
|
||||||
|
// ardrone_time2date(t, ARDRONE_FILE_DATE_FORMAT, date);
|
||||||
|
strftime(date, ARDRONE_DATE_MAXSIZE, ARDRONE_FILE_DATE_FORMAT, localtime(&t));
|
||||||
|
snprintf(record_command, sizeof(record_command), "%d,%s", USERBOX_CMD_START, date);
|
||||||
|
new_codec = MP4_360P_H264_720P_CODEC;
|
||||||
|
} else {
|
||||||
|
snprintf(record_command, sizeof(record_command), "%d", USERBOX_CMD_STOP );
|
||||||
|
new_codec = H264_360P_CODEC;
|
||||||
|
}
|
||||||
|
|
||||||
|
vp_os_mutex_lock(&twist_lock);
|
||||||
|
ARDRONE_TOOL_CONFIGURATION_ADDEVENT (video_codec, &new_codec, NULL );
|
||||||
|
ARDRONE_TOOL_CONFIGURATION_ADDEVENT (userbox_cmd, record_command, NULL );
|
||||||
|
vp_os_mutex_unlock(&twist_lock);
|
||||||
|
|
||||||
|
response.result = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool setLedAnimationCallback(ardrone_autonomy::LedAnim::Request& request, ardrone_autonomy::LedAnim::Response& response)
|
bool setLedAnimationCallback(ardrone_autonomy::LedAnim::Request& request, ardrone_autonomy::LedAnim::Response& response)
|
||||||
{
|
{
|
||||||
LED_ANIMATION_IDS anim_id = ledAnimMap[request.type % 14]; // Don't trick me
|
LED_ANIMATION_IDS anim_id = ledAnimMap[request.type % 14]; // Don't trick me
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include <ardrone_autonomy/CamSelect.h>
|
#include <ardrone_autonomy/CamSelect.h>
|
||||||
#include <ardrone_autonomy/LedAnim.h>
|
#include <ardrone_autonomy/LedAnim.h>
|
||||||
#include <ardrone_autonomy/FlightAnim.h>
|
#include <ardrone_autonomy/FlightAnim.h>
|
||||||
|
#include <ardrone_autonomy/RecordEnable.h>
|
||||||
|
|
||||||
#define _EPS 1.0e-6
|
#define _EPS 1.0e-6
|
||||||
|
|
||||||
@@ -24,6 +25,7 @@ bool toggleCamCallback(std_srvs::Empty::Request& request, std_srvs::Empty::Respo
|
|||||||
bool setLedAnimationCallback(ardrone_autonomy::LedAnim::Request& request, ardrone_autonomy::LedAnim::Response& response);
|
bool setLedAnimationCallback(ardrone_autonomy::LedAnim::Request& request, ardrone_autonomy::LedAnim::Response& response);
|
||||||
bool flatTrimCallback(std_srvs::Empty::Request& request, std_srvs::Empty::Response& response);
|
bool flatTrimCallback(std_srvs::Empty::Request& request, std_srvs::Empty::Response& response);
|
||||||
bool setFlightAnimationCallback(ardrone_autonomy::FlightAnim::Request& request, ardrone_autonomy::FlightAnim::Response& response);
|
bool setFlightAnimationCallback(ardrone_autonomy::FlightAnim::Request& request, ardrone_autonomy::FlightAnim::Response& response);
|
||||||
|
bool setRecordCallback(ardrone_autonomy::RecordEnable::Request &request, ardrone_autonomy::RecordEnable::Response& response);
|
||||||
|
|
||||||
//All global drone configs that should be sent on init
|
//All global drone configs that should be sent on init
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
bool enable
|
||||||
|
---
|
||||||
|
bool result
|
||||||
Referência em uma Nova Issue
Bloquear um usuário