My first phase of changes to:

1) Solved CMakeList.txt problem with SDL library
2) Commented out the line of the code that was nagging about unknown tagdata
3) Added the service for turning navdata_demo on/off
4) Sending critical configuration some time after init.
Esse commit está contido em:
Mani Monajjemi
2012-05-15 15:27:16 -07:00
commit 5be5536b8e
7 arquivos alterados com 55 adições e 7 exclusões
@@ -130,7 +130,7 @@ C_RESULT ardrone_navdata_unpack_all(navdata_unpacked_t* navdata_unpacked, navdat
default:
PRINT("Tag %d is an unknown navdata option tag\n", (int) navdata_option_ptr->tag);
//PRINT("Tag %d is an unknown navdata option tag\n", (int) navdata_option_ptr->tag);
navdata_option_ptr = (navdata_option_t *)(((uint32_t)navdata_option_ptr) + navdata_option_ptr->size);
break;
}
+1 -1
Ver Arquivo
@@ -32,4 +32,4 @@ set(SDK ARDroneLib/)
link_directories(${PROJECT_SOURCE_DIR}/lib/)
include_directories(${SDK} ${SDK}/Soft/Common ${SDK}/Soft/Lib ${SDK}/VP_SDK ${SDK}/VP_SDK/VP_Os/linux)
rosbuild_add_executable(ardrone_driver src/ardrone_driver.cpp src/video.cpp src/ardrone_sdk.cpp src/teleop_twist.cpp)
target_link_libraries(ardrone_driver vlib pc_ardrone SDL sdk)
target_link_libraries(ardrone_driver vlib pc_ardrone sdk SDL)
+4 -1
Ver Arquivo
@@ -1,4 +1,7 @@
ardrone_brown_mod
=================
The fork of ardrone_brown ROS driver
The fork of ardrone_brown ROS driver from
http://brown-ros-pkg.googlecode.com/svn/trunk/experimental/ardrone_brown --revision 2775
+35 -3
Ver Arquivo
@@ -20,7 +20,7 @@ ARDroneDriver::ARDroneDriver()
#ifdef _USING_SDK_1_7_
//Ensure that the horizontal camera is running
int cam_state = 0; // horizontal
int set_navdata_demo_value = 0;
int set_navdata_demo_value = 1;
ARDRONE_TOOL_CONFIGURATION_ADDEVENT (video_channel, &cam_state, NULL);
ARDRONE_TOOL_CONFIGURATION_ADDEVENT (navdata_demo, &set_navdata_demo_value, NULL);
#else
@@ -29,8 +29,7 @@ ARDroneDriver::ARDroneDriver()
#endif
toggleCam_service = node_handle.advertiseService("/ardrone/togglecam", toggleCamCallback);
toggleNavdataDemo_service = node_handle.advertiseService("/ardrone/togglenavdatademo", toggleNavdataDemoCallback);
}
ARDroneDriver::~ARDroneDriver()
@@ -41,8 +40,41 @@ void ARDroneDriver::run()
{
ros::Rate loop_rate(40);
int configWate = 250;
int cam_state = 0; // horizontal
int set_navdata_demo_value = 1; // Low bandwidth usage
bool configDone = false;
//These are some extra params (experimental)
int mCodec = P264_CODEC;
int vbcMode = VBC_MODE_DYNAMIC;
while (node_handle.ok())
{
// For some unknown reason, sometimes the ardrone critical configurations are not applied
// when the commands are being sent during SDK initialization. This is a trick to send critical
// configurations sometime after SDK boots up. The navdata_demo saves around 300 KBytes/Sec bw!
if (configDone == false)
{
configWate--;
if (configWate == 0)
{
configDone = true;
fprintf(stderr, "\nSending some critical initial configuration after some delay...\n");
#ifdef _USING_SDK_1_7_
//Ensure that the horizontal camera is running
ARDRONE_TOOL_CONFIGURATION_ADDEVENT (video_channel, &cam_state, NULL);
ARDRONE_TOOL_CONFIGURATION_ADDEVENT (navdata_demo, &set_navdata_demo_value, NULL);
//ARDRONE_TOOL_CONFIGURATION_ADDEVENT (video_codec, &mCodec, NULL);
//ARDRONE_TOOL_CONFIGURATION_ADDEVENT (bitrate_ctrl_mode, &vbcMode, NULL);
#else
//Ensure that the horizontal camera is running
ardrone_at_set_toy_configuration("video:video_channel","0");
#endif
}
}
if (current_frame_id != last_frame_id)
{
publish_video();
+1
Ver Arquivo
@@ -30,6 +30,7 @@ private:
//ros::Subscriber toggleCam_sub;
ros::ServiceServer toggleCam_service;
ros::ServiceServer toggleNavdataDemo_service;
int last_frame_id;
int flying_state;
+11 -1
Ver Arquivo
@@ -7,7 +7,17 @@ bool is_flying = false;
bool needs_reset = false;
geometry_msgs::Twist cmd_vel;
int cam_state=0; // 0 for forward and 1 for vertical, change to enum later
int cam_state = 0; // 0 for forward and 1 for vertical, change to enum later
int set_navdata_demo_value = TRUE;
bool toggleNavdataDemoCallback(std_srvs::Empty::Request& request, std_srvs::Empty::Response& response)
{
set_navdata_demo_value ^= 1;
ARDRONE_TOOL_CONFIGURATION_ADDEVENT (navdata_demo, &set_navdata_demo_value, NULL);
fprintf(stderr, "\nToggling navdata_demo, set to %d.\n", set_navdata_demo_value);
return true;
}
// ros service callback function for toggling Cam
bool toggleCamCallback(std_srvs::Empty::Request& request, std_srvs::Empty::Response& response)
+2
Ver Arquivo
@@ -17,5 +17,7 @@ void takeoffCallback(const std_msgs::Empty &msg);
//void toggleCamCallback(const std_msgs::Empty &msg);
bool toggleCamCallback(std_srvs::Empty::Request& request, std_srvs::Empty::Response& response);
bool toggleNavdataDemoCallback(std_srvs::Empty::Request& request, std_srvs::Empty::Response& response);
#endif