Skip to content

Commit

Permalink
Merge pull request AutonomyLab#17 from adamantivm/android-video
Browse files Browse the repository at this point in the history
Android video
  • Loading branch information
manzato committed Sep 16, 2014
2 parents 136b4bd + b9e9458 commit 13ba115
Show file tree
Hide file tree
Showing 12 changed files with 459 additions and 50 deletions.
26 changes: 26 additions & 0 deletions ARDroneSDK/debug-symbols.old.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/ARDroneLib/Soft/Build/config.makefile b/ARDroneLib/Soft/Build/config.makefile
index eb257e2..45e4ed3 100644
--- a/ARDroneLib/Soft/Build/config.makefile
+++ b/ARDroneLib/Soft/Build/config.makefile
@@ -126,6 +126,7 @@ ifdef PC_TARGET
endif

ifeq ("$(USE_ANDROID)","yes")
+ GENERIC_CFLAGS+=-g
SDK_FLAGS+="USE_ANDROID=yes"
SDK_FLAGS+="TOOLCHAIN_VERSION=arm-linux-androideabi-4.6"
SDK_FLAGS+="NDK_PLATFORM_VERSION=android-8"
diff --git a/ARDroneLib/Soft/Build/config.makefile b/ARDroneLib/Soft/Build/config.makefile
index 57a5b0f..ac5ace6 100644
--- a/ARDroneLib/Soft/Build/config.makefile
+++ b/ARDroneLib/Soft/Build/config.makefile
@@ -3,7 +3,7 @@
# Common build definitions (CUSTOM)
#########################################################

-RELEASE_BUILD = yes
+RELEASE_BUILD = no
QUIET_BUILD = yes
VPSDK_PARALLEL_BUILD = no


14 changes: 14 additions & 0 deletions ARDroneSDK/debug-symbols.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/ARDroneLib/Soft/Build/config.makefile b/ARDroneLib/Soft/Build/config.makefile
index 57a5b0f..ac5ace6 100644
--- a/ARDroneLib/Soft/Build/config.makefile
+++ b/ARDroneLib/Soft/Build/config.makefile
@@ -3,7 +3,7 @@
# Common build definitions (CUSTOM)
#########################################################

-RELEASE_BUILD = yes
+RELEASE_BUILD = no
QUIET_BUILD = yes
VPSDK_PARALLEL_BUILD = no


12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,19 @@ catkin_package(
libsdl-dev
)

# Pass through build type to ardronelib by deciding whether or not to apply patch
IF(CMAKE_BUILD_TYPE MATCHES Debug)
set(DEBUG_SYMBOLS_PATCH "${PROJECT_SOURCE_DIR}/ARDroneSDK/debug-symbols.patch")
ELSE(CMAKE_BUILD_TYPE MATCHES Debug)
set(DEBUG_SYMBOLS_PATCH "/dev/null")
ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)

include(ExternalProject)
externalproject_add(ardronelib
URL ${PROJECT_SOURCE_DIR}/ARDroneSDK/ardrone-sdk-stripped-2.0.1.tgz
PREFIX ${CMAKE_BINARY_DIR}/ardrone
PATCH_COMMAND
patch -p1 < ${DEBUG_SYMBOLS_PATCH} &&
patch -p1 < ${PROJECT_SOURCE_DIR}/ARDroneSDK/ardrone_lib.patch &&
patch -p0 < ${PROJECT_SOURCE_DIR}/ARDroneSDK/ardrone-sdk-navdata-common-gps.patch &&
patch -p0 < ${PROJECT_SOURCE_DIR}/ARDroneSDK/ardrone-sdk-navdata-keys-gps.patch &&
Expand Down Expand Up @@ -132,6 +140,8 @@ add_library(ardrone_driver
src/ardrone_driver.cpp
src/video.cpp
src/teleop_twist.cpp
src/opengl_stage.c
src/opengl_shader.c
)
target_link_libraries(ardrone_driver
# pc_ardrone
Expand All @@ -140,6 +150,7 @@ target_link_libraries(ardrone_driver
# avutil
# vlib
# sdk
GLESv2
${Boost_LIBRARIES}
${catkin_LIBRARIES}
)
Expand All @@ -154,6 +165,7 @@ target_link_libraries(ardrone_sdk
# avutil
# vlib
# sdk
GLESv2
${Boost_LIBRARIES}
${catkin_LIBRARIES}
)
Expand Down
10 changes: 5 additions & 5 deletions include/ardrone_autonomy/ardrone_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@ class ARDroneDriver
ros::Subscriber takeoff_sub;
ros::Subscriber reset_sub;
ros::Subscriber land_sub;
image_transport::ImageTransport image_transport;
image_transport::CameraPublisher image_pub;
image_transport::CameraPublisher hori_pub;
image_transport::CameraPublisher vert_pub;
//image_transport::ImageTransport image_transport;
// image_transport::CameraPublisher image_pub;
ros::Publisher image_pub;
//image_transport::CameraPublisher hori_pub;
//image_transport::CameraPublisher vert_pub;

camera_info_manager::CameraInfoManager *cinfo_hori_;
camera_info_manager::CameraInfoManager *cinfo_vert_;
Expand Down Expand Up @@ -168,7 +169,6 @@ class ARDroneDriver

// For throttling battery, state and gps
int counter_;
int gps_counter_;
bool first_time_pressure_;
unsigned int zero_pressure;
};
Expand Down
2 changes: 1 addition & 1 deletion include/ardrone_autonomy/ardrone_sdk.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ extern "C" {
#include <ardrone_tool/ardrone_tool_configuration.h>
#include <ardrone_tool/Com/config_com.h>
#include <ardrone_tool/UI/ardrone_input.h>
#include <ardrone_tool/Video/video_com_stage.h>
#include <ardrone_tool/Control/ardrone_control.h>
#include <ardrone_tool/Navdata/ardrone_navdata_client.h>

#include <ardrone_tool/Video/video_com_stage.h>
#include <ardrone_tool/Video/video_stage.h>
#include <ardrone_tool/Video/video_recorder_pipeline.h>
#include <ardrone_tool/Video/video_stage_latency_estimation.h>
Expand Down
21 changes: 21 additions & 0 deletions include/ardrone_autonomy/opengl_shader.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// Shaders.h
// FreeFlight
//
// Created by Frédéric D'HAEYER on 24/10/11.
// Copyright 2011 PARROT. All rights reserved.
//
#ifndef _OPENGL_SHADER_H_
#define _OPENGL_SHADER_H_
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>

// #define DEBUG_SHADER

/* Shader Utilities */
GLint opengl_shader_compile(GLuint *shader, GLenum type, GLsizei count, const char *content_file);
GLint opengl_shader_link(GLuint prog);
GLint opengl_shader_validate(GLuint prog);
void opengl_shader_destroy(GLuint vertShader, GLuint fragShader, GLuint prog);

#endif // _OPENGL_SHADER_H_
52 changes: 52 additions & 0 deletions include/ardrone_autonomy/opengl_stage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* opengl_stage.h
* Test
*
* Created by Karl Leplat on 22/02/10.
* Copyright 2010 Parrot SA. All rights reserved.
*
*/
#ifndef _OPENGL_STAGE_H_
#define _OPENGL_STAGE_H_

#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>

// TODO: Move this define to CMake
#ifndef FFMPEG_SUPPORT
#define FFMPEG_SUPPORT
#endif

#include <ardrone_tool/Video/video_stage.h>

typedef struct _opengl_video_config_t
{
video_decoder_config_t *video_decoder;
vp_os_mutex_t mutex;
GLuint widthImage;
GLuint heightImage;
GLuint widthTexture;
GLuint heightTexture;

GLfloat scaleModelX;
GLfloat scaleModelY;
GLfloat scaleTextureX;
GLfloat scaleTextureY;
GLuint bytesPerPixel;
GLenum format;
GLenum type;
void* data;
GLuint identifier;
uint32_t num_picture_decoded;
uint32_t num_frames;
} opengl_video_stage_config_t;

C_RESULT opengl_video_stage_open(opengl_video_stage_config_t *cfg);
C_RESULT opengl_video_stage_transform(opengl_video_stage_config_t *cfg, vp_api_io_data_t *in, vp_api_io_data_t *out);
C_RESULT opengl_video_stage_close(opengl_video_stage_config_t *cfg);

opengl_video_stage_config_t* opengl_video_stage_get(void);

extern const vp_api_stage_funcs_t opengl_video_stage_funcs;

#endif // _OPENGL_STAGE_H_
2 changes: 2 additions & 0 deletions include/ardrone_autonomy/video.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef _VIDEO_H_
#define _VIDEO_H_

// #include <ardrone_autonomy/opengl_stage.h>
// #include <ardrone_autonomy/opengl_shader.h>
#include <ardrone_autonomy/ardrone_sdk.h>
#include <ardrone_autonomy/ardrone_driver.h>

Expand Down
Loading

0 comments on commit 13ba115

Please sign in to comment.