Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter throught callback #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Tools/sitl_gazebo
Submodule sitl_gazebo updated 38 files
+3 −3 CMakeLists.txt
+2 −1 include/mavlink_interface.h
+137 −0 models/3DR_gps_mag/3DR_gps_mag.sdf
+1 −1 models/3DR_gps_mag/model.config
+80 −0 models/c920/c920.sdf
+1 −1 models/c920/model.config
+677 −0 models/cloudship/cloudship.sdf
+1 −1 models/cloudship/model.config
+1,771 −0 models/indus/indus.sdf
+ models/indus/meshes/corps_azymut.stl
+160 −0 models/indus/meshes/iris_prop_ccw.dae
+160 −0 models/indus/meshes/iris_prop_cw.dae
+64 −0 models/indus/meshes/untitled.dae
+ models/indus/meshes/untitled.stl
+56 −0 models/indus/meshes/x8_elevon_left.dae
+56 −0 models/indus/meshes/x8_elevon_right.dae
+56 −0 models/indus/meshes/x8_wing.dae
+14 −0 models/indus/model.config
+705 −0 models/matrice_100/matrice_100.sdf
+1 −1 models/matrice_100/model.config
+57 −0 models/mb1240-xl-ez4/mb1240-xl-ez4.sdf
+1 −1 models/mb1240-xl-ez4/model.config
+1 −1 models/pixhawk/model.config
+161 −0 models/pixhawk/pixhawk.sdf
+1 −1 models/plane/model.config
+771 −0 models/plane/plane.sdf
+1 −1 models/px4flow/model.config
+107 −0 models/px4flow/px4flow.sdf
+1 −1 models/r200/model.config
+92 −0 models/r200/r200.sdf
+1 −1 models/sf10a/model.config
+79 −0 models/sf10a/sf10a.sdf
+1 −1 models/standard_vtol/model.config
+1,033 −0 models/standard_vtol/standard_vtol.sdf
+1 −1 scripts/jinja_gen.py
+2 −2 scripts/validate_sdf.bash
+4 −1 src/gazebo_geotagged_images_plugin.cpp
+5 −8 src/mavlink_interface.cpp
75 changes: 75 additions & 0 deletions src/lib/mixer_module/mixer_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,81 @@ int MixingOutput::controlCallback(uintptr_t handle, uint8_t control_group, uint8
{
const MixingOutput *output = (const MixingOutput *)handle;

if(control_group==100)
{
int input_int=0;
input_int--;
switch (control_index)
{//AUTOGENERATED START
case 18: ///AUTOGENERATED
param_get(param_find("PWM_TILT_MAX2"), &input_int); ///AUTOGENERATED
input=input_int; ///AUTOGENERATED
break; ///AUTOGENERATED
case 17: ///AUTOGENERATED
param_get(param_find("PWM_TILT_MAX1"), &input_int); ///AUTOGENERATED
input=input_int; ///AUTOGENERATED
break; ///AUTOGENERATED
case 16: ///AUTOGENERATED
param_get(param_find("PWM_TILT_MIN2"), &input_int); ///AUTOGENERATED
input=input_int; ///AUTOGENERATED
break; ///AUTOGENERATED
case 15: ///AUTOGENERATED
param_get(param_find("PWM_TILT_MIN1"), &input_int); ///AUTOGENERATED
input=input_int; ///AUTOGENERATED
break; ///AUTOGENERATED
case 14: ///AUTOGENERATED
param_get(param_find("PWM_MIN"), &input_int); ///AUTOGENERATED
input=input_int; ///AUTOGENERATED
break; ///AUTOGENERATED
case 13: ///AUTOGENERATED
param_get(param_find("PWM_MAX"), &input_int); ///AUTOGENERATED
input=input_int; ///AUTOGENERATED
break; ///AUTOGENERATED
case 12: ///AUTOGENERATED
param_get(param_find("MC_YAWRATE_K"), &input); ///AUTOGENERATED
break; ///AUTOGENERATED
case 11: ///AUTOGENERATED
param_get(param_find("MC_PITCHRATE_K"), &input); ///AUTOGENERATED
break; ///AUTOGENERATED
case 10: ///AUTOGENERATED
param_get(param_find("MC_ROLLRATE_K"), &input); ///AUTOGENERATED
break; ///AUTOGENERATED
case 9: ///AUTOGENERATED
param_get(param_find("ANG_TILT_MIN2"), &input); ///AUTOGENERATED
break; ///AUTOGENERATED
case 8: ///AUTOGENERATED
param_get(param_find("ANG_TILT_MAX2"), &input); ///AUTOGENERATED
break; ///AUTOGENERATED
case 7: ///AUTOGENERATED
param_get(param_find("ANG_TILT_MIN1"), &input); ///AUTOGENERATED
break; ///AUTOGENERATED
case 6: ///AUTOGENERATED
param_get(param_find("ANG_TILT_MAX1"), &input_int); ///AUTOGENERATED
input=input_int; ///AUTOGENERATED
break; ///AUTOGENERATED
case 5: ///AUTOGENERATED
param_get(param_find("MC_CM_DRAG"), &input); ///AUTOGENERATED
break; ///AUTOGENERATED
case 4: ///AUTOGENERATED
param_get(param_find("MC_CT_LIFT"), &input); ///AUTOGENERATED
break; ///AUTOGENERATED
case 3: ///AUTOGENERATED
param_get(param_find("MC_INERTIA_ZZ"), &input); ///AUTOGENERATED
break; ///AUTOGENERATED
case 2: ///AUTOGENERATED
param_get(param_find("MC_INERTIA_YY"), &input); ///AUTOGENERATED
break; ///AUTOGENERATED
case 1: ///AUTOGENERATED
param_get(param_find("MC_INERTIA_XX"), &input); ///AUTOGENERATED
break; ///AUTOGENERATED
case 0: ///AUTOGENERATED
param_get(param_find("MC_MASS"), &input); ///AUTOGENERATED
break; ///AUTOGENERATED
break;
}//AUTOGENERATED END
return 0;
}

input = output->_controls[control_group].control[control_index];

/* limit control input */
Expand Down
19 changes: 9 additions & 10 deletions src/lib/parameters/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ endif()
get_property(module_list GLOBAL PROPERTY PX4_MODULE_PATHS)
get_property(module_config_files GLOBAL PROPERTY PX4_MODULE_CONFIG_FILES)



if(DISABLE_PARAMS_MODULE_SCOPING)
# search all directories with .c files (potentially containing parameters)
file(GLOB_RECURSE c_files
Expand Down Expand Up @@ -80,7 +78,7 @@ add_custom_command(OUTPUT ${generated_serial_params_file}
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/serial/generate_config.py
--params-file ${generated_serial_params_file}
--serial-ports ${board_serial_ports} ${added_arguments}
--config-files ${module_config_files} #--verbose
--config-files ${module_config_files} #--verbose
DEPENDS
${module_config_files}
${jinja_templates}
Expand All @@ -91,8 +89,7 @@ add_custom_command(OUTPUT ${generated_serial_params_file}
set(parameters_xml ${PX4_BINARY_DIR}/parameters.xml)
set(parameters_json ${PX4_BINARY_DIR}/parameters.json)
file(GLOB_RECURSE param_src_files ${PX4_SOURCE_DIR}/src/*params.c)

add_custom_command(OUTPUT ${parameters_xml} ${parameters_json}
add_custom_command(OUTPUT ${parameters_xml} ${parameters_json} ${parameters_json}.gz
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/px_process_params.py
--src-path ${module_list} ${generated_params_dir}
--xml ${parameters_xml}
Expand All @@ -101,7 +98,7 @@ add_custom_command(OUTPUT ${parameters_xml} ${parameters_json}
--inject-xml ${CMAKE_CURRENT_SOURCE_DIR}/parameters_injected.xml
--overrides ${PARAM_DEFAULT_OVERRIDES}
--board ${PX4_BOARD}
#--verbose
#--verbose
DEPENDS
${param_src_files}
${generated_serial_params_file}
Expand All @@ -112,7 +109,7 @@ add_custom_command(OUTPUT ${parameters_xml} ${parameters_json}
px4params/xmlout.py
px_process_params.py
parameters_injected.xml
COMMENT "Generating parameters.xml [${CMAKE_CURRENT_SOURCE_DIR}/px_process_params.py]"
COMMENT "Generating parameters.xml"
)
add_custom_target(parameters_xml DEPENDS ${parameters_xml})

Expand All @@ -126,7 +123,6 @@ add_custom_command(OUTPUT px4_parameters.c px4_parameters.h px4_parameters_publi
templates/px4_parameters.c.jinja
templates/px4_parameters.h.jinja
templates/px4_parameters_public.h.jinja
COMMENT " [${CMAKE_CURRENT_SOURCE_DIR}/px_generate_params.py]"
)

set(SRCS)
Expand All @@ -148,14 +144,15 @@ if(${PX4_PLATFORM} STREQUAL "nuttx")
endif()

# TODO: find a better way to do this
if (NOT "${PX4_BOARD}" MATCHES "px4_io")
add_library(parameters
${SRCS}
px4_parameters.c
px4_parameters.h
px4_parameters_public.h
)

if ("${CONFIG_SHMEM}" STREQUAL "1")
if ("${CONFIG_SHMEM}" STREQUAL "1")
target_link_libraries(parameters PRIVATE px4_layer)
endif()

Expand All @@ -166,7 +163,9 @@ endif()
-Wno-cast-align # TODO: fix and enable
-Wno-sign-compare # TODO: fix and enable
)

else()
add_library(parameters ${PX4_SOURCE_DIR}/platforms/common/empty.c)
endif()
add_dependencies(parameters prebuild_targets)

if(${PX4_PLATFORM} STREQUAL "nuttx")
Expand Down