Skip to content

Commit

Permalink
final test
Browse files Browse the repository at this point in the history
  • Loading branch information
TienPoly committed Sep 25, 2018
1 parent 5046e74 commit fb45d2f
Show file tree
Hide file tree
Showing 30 changed files with 4,053 additions and 964 deletions.
56 changes: 35 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ project(gsft_control)
find_package(catkin REQUIRED COMPONENTS
dynamic_reconfigure
mav_msgs
asctec_hl_comm
nav_msgs
sensor_msgs
cmake_modules
Expand Down Expand Up @@ -114,7 +115,7 @@ generate_dynamic_reconfigure_options(
catkin_package(
INCLUDE_DIRS include
## LIBRARIES gsft_control
CATKIN_DEPENDS dynamic_reconfigure geometry_msgs mav_msgs nav_msgs roscpp sensor_msgs trajectory_msgs message_generation std_msgs geometry_msgs
CATKIN_DEPENDS dynamic_reconfigure geometry_msgs mav_msgs nav_msgs roscpp sensor_msgs trajectory_msgs message_generation std_msgs geometry_msgs asctec_hl_comm
DEPENDS EIGEN3
)

Expand All @@ -128,23 +129,27 @@ include_directories(
include
R2017a/extern/include
R2017a/simulink/include
src/tunning_lqr_grt_rtw/
src/tunning_nominal_grt_rtw/
src/tuning_lqr_grt_rtw/
src/tuning_nominal_grt_rtw/
src/tuning_GS1_grt_rtw/
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS}
)

add_library(matlab_simulink

src/tunning_lqr_grt_rtw/tunning_lqr_data.cpp
src/tunning_lqr_grt_rtw/tunning_lqr.cpp
src/tuning_lqr_grt_rtw/tuning_lqr_data.cpp
src/tuning_lqr_grt_rtw/tuning_lqr.cpp

src/tunning_nominal_grt_rtw/tunning_nominal_data.cpp
src/tunning_nominal_grt_rtw/tunning_nominal.cpp
src/tuning_nominal_grt_rtw/tuning_nominal_data.cpp
src/tuning_nominal_grt_rtw/tuning_nominal.cpp

#src/tunning_nominal_grt_rtw/rtGetInf.cpp
#src/tunning_nominal_grt_rtw/rtGetNaN.cpp
#src/tunning_nominal_grt_rtw/rt_nonfinite.cpp
src/tuning_GS1_grt_rtw/tuning_GS1_data.cpp
src/tuning_GS1_grt_rtw/tuning_GS1.cpp

#src/tuning_nominal_grt_rtw/rtGetInf.cpp
#src/tuning_nominal_grt_rtw/rtGetNaN.cpp
#src/tuning_nominal_grt_rtw/rt_nonfinite.cpp

)
add_dependencies(matlab_simulink ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
Expand All @@ -153,35 +158,44 @@ add_dependencies(matlab_simulink ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EX
## With catkin_make all packages are built within a single CMake context
## The recommended prefix ensures that target names across packages don't collide

add_executable(tunning_lqr_node
src/tunning_lqr_node.cpp
add_executable(tuning_lqr_node
src/tuning_lqr_node.cpp
)
add_dependencies(tunning_lqr_node
add_dependencies(tuning_lqr_node
${${PROJECT_NAME}_EXPORTED_TARGETS}
${catkin_EXPORTED_TARGETS}
matlab_simulink
)
target_link_libraries(tunning_lqr_node
target_link_libraries(tuning_lqr_node
matlab_simulink
${catkin_LIBRARIES}
)




add_executable(tunning_nominal_node
src/tunning_nominal_node.cpp
add_executable(tuning_nominal_node
src/tuning_nominal_node.cpp
)
add_dependencies(tunning_nominal_node
add_dependencies(tuning_nominal_node
${${PROJECT_NAME}_EXPORTED_TARGETS}
${catkin_EXPORTED_TARGETS}
matlab_simulink
)
target_link_libraries(tunning_nominal_node
target_link_libraries(tuning_nominal_node
matlab_simulink
${catkin_LIBRARIES}
)

add_executable(tuning_GS1_node
src/tuning_GS1_node.cpp
)
add_dependencies(tuning_GS1_node
${${PROJECT_NAME}_EXPORTED_TARGETS}
${catkin_EXPORTED_TARGETS}
matlab_simulink
)
target_link_libraries(tuning_GS1_node
matlab_simulink
${catkin_LIBRARIES}
)

#############
## Install ##
Expand Down
59 changes: 59 additions & 0 deletions cfg/GS1_Dyn.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#! /usr/bin/env python

PACKAGE='gsft_control'
import roslib
roslib.load_manifest(PACKAGE)

from dynamic_reconfigure.parameter_generator_catkin import *

gen = ParameterGenerator()

ENABLE_CTRL = gen.const("ENABLE_CTRL", int_t, 0x00000001, "enable_ctrl")
NEW_REFERENCES = gen.const("NEW_REFERENCES", int_t, 0x00000002, "new_references")
#NEW_PARAMETERS = gen.const("NEW_PARAMETERS", int_t, 0x00000004, "drone_parameter")
CONTROLLER_GAIN = gen.const("CONTROLLER_GAIN", int_t, 0x00000008, "controller_gain")
#LOE = gen.const("LOE", int_t, 0x01000000, "lost_of_control_effectiveness")

group1 = gen.add_group("group_control")
group2 = gen.add_group("group_waypoint_references")
#group3 = gen.add_group("group3_drone_parameters")
group4 = gen.add_group("group_controller_gains")
group5 = gen.add_group("group_LOE")

# Name Type Reconfiguration level Description Default Min Max
gen.add("RESET", bool_t, 0, "reset parameters, gains", False)

test_mode_enum = gen.enum([ gen.const("TEST_MANUAL", int_t, 0, "Manual test"),
gen.const("TEST_WAYPOINT", int_t, 1, "Waypoint test"),
gen.const("TEST_TRACKING", int_t, 2, "Circular tracking test")],
"An enum to chose test mode")
gen.add("test_mode", int_t, 0, "test mode", 0, 0, 2, edit_method=test_mode_enum)

group1.add("enable_take_off", bool_t, ENABLE_CTRL["value"], "enable take off", False) # ENABLE_CTRL["value"] = 0x00000001
group1.add("enable_landing", bool_t, ENABLE_CTRL["value"], "enable landing", False)
group1.add("send_waypoint", bool_t, ENABLE_CTRL["value"], "send new waypoint", False)
group1.add("new_controller_gains", bool_t, ENABLE_CTRL["value"], "change controller gains", False)
#group1.add("new_drone_parameters", bool_t, ENABLE_CTRL["value"], "change drone parameters", False) # to do later
#group1.add("enable_yaw", bool_t, ENABLE_CTRL["value"], "enable yaw-control", True) # to do later
#group1.add("enable_gohome", bool_t, ENABLE_CTRL["value"], "enable go home", False) # to do later

group2.add("ref_x", double_t, NEW_REFERENCES["value"], "X position reference", 0.0, -2.0, 2.0)
group2.add("ref_y", double_t, NEW_REFERENCES["value"], "Y position reference", 0.0, -2.0, 2.0)
group2.add("ref_z", double_t, NEW_REFERENCES["value"], "Z position reference", 0.5, 0.0, 1.5)
group2.add("ref_yaw_deg", double_t, NEW_REFERENCES["value"], "yaw angle reference", 0.0, -180.0, 180.0)

group5.add("LOE_1", double_t, 0.0, "lost of control 1", 0.0, 0.0, 1.0)
group5.add("LOE_2", double_t, 0.0, "lost of control 2", 0.0, 0.0, 1.0)
group5.add("LOE_3", double_t, 0.0, "lost of control 3", 0.0, 0.0, 1.0)
group5.add("LOE_4", double_t, 0.0, "lost of control 4", 0.0, 0.0, 1.0)
group5.add("LOE_5", double_t, 0.0, "lost of control 5", 0.0, 0.0, 1.0)
group5.add("LOE_6", double_t, 0.0, "lost of control 6", 0.0, 0.0, 1.0)
group5.add("LOE_t1", double_t, 0.0, "occurs time 1", 0.0, 0.0, 100.0)
group5.add("LOE_t2", double_t, 0.0, "occurs time 2", 0.0, 0.0, 100.0)
group5.add("LOE_t3", double_t, 0.0, "occurs time 3", 0.0, 0.0, 100.0)
group5.add("LOE_t4", double_t, 0.0, "occurs time 4", 0.0, 0.0, 100.0)
group5.add("LOE_t5", double_t, 0.0, "occurs time 5", 0.0, 0.0, 100.0)
group5.add("LOE_t6", double_t, 0.0, "occurs time 6", 0.0, 0.0, 100.0)


exit(gen.generate(PACKAGE, "gsft_control", "controllerDyn"))
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<depend>cmake_modules</depend>
<depend>geometry_msgs</depend>
<depend>mav_msgs</depend>
<depend>asctec_hl_comm</depend>
<depend>nav_msgs</depend>
<depend>sensor_msgs</depend>
<depend>trajectory_msgs</depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
* perform academic research at degree granting institutions only. Not
* for government, commercial, or other organizational use.
*
* Code generation for model "tunning_nominal".
* Code generation for model "tuning_GS1".
*
* Model version : 1.1498
* Simulink Coder version : 8.12 (R2017a) 16-Feb-2017
* C++ source code generated on : Fri Aug 31 14:28:54 2018
* C++ source code generated on : Tue Sep 18 10:42:41 2018
*
* Target selection: grt.tlc
* Note: GRT includes extra infrastructure and instrumentation for prototyping
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
* perform academic research at degree granting institutions only. Not
* for government, commercial, or other organizational use.
*
* Code generation for model "tunning_nominal".
* Code generation for model "tuning_GS1".
*
* Model version : 1.1498
* Simulink Coder version : 8.12 (R2017a) 16-Feb-2017
* C++ source code generated on : Fri Aug 31 14:28:54 2018
* C++ source code generated on : Tue Sep 18 10:42:41 2018
*
* Target selection: grt.tlc
* Note: GRT includes extra infrastructure and instrumentation for prototyping
Expand All @@ -24,7 +24,7 @@
/*
* Includes the appropriate headers when we are using rtModel
*/
#include "tunning_nominal.h"
#include "tuning_GS1.h"
#define GRTINTERFACE 0

/*
Expand All @@ -33,6 +33,6 @@
* ROOT_IO_FORMAT: 2 (Part of model data structure)
*/
# define ROOT_IO_FORMAT 2
#define MODEL_CLASSNAME tunning_nominalModelClass
#define MODEL_CLASSNAME tuning_GS1ModelClass
#define MODEL_STEPNAME step
#endif /* RTW_HEADER_rtmodel_h_ */
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
* perform academic research at degree granting institutions only. Not
* for government, commercial, or other organizational use.
*
* Code generation for model "tunning_nominal".
* Code generation for model "tuning_GS1".
*
* Model version : 1.1498
* Simulink Coder version : 8.12 (R2017a) 16-Feb-2017
* C++ source code generated on : Fri Aug 31 14:28:54 2018
* C++ source code generated on : Tue Sep 18 10:42:41 2018
*
* Target selection: grt.tlc
* Note: GRT includes extra infrastructure and instrumentation for prototyping
Expand Down
Loading

0 comments on commit fb45d2f

Please sign in to comment.