Skip to content

Commit

Permalink
fix errors after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-dvorak committed Jul 22, 2023
1 parent 9bea4a5 commit 3bb2b1c
Show file tree
Hide file tree
Showing 10 changed files with 263 additions and 155 deletions.
File renamed without changes.
116 changes: 39 additions & 77 deletions msg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,48 +228,8 @@ set(msg_files
YawEstimatorStatus.msg
)

if(NOT px4_constrained_flash_build)
list(APPEND msg_files
debug_array.msg
debug_key_value.msg
debug_value.msg
debug_vect.msg
)
endif()

if(PX4_TESTING)
list(APPEND msg_files
orb_test.msg
orb_test_large.msg
orb_test_medium.msg
)
endif()

list(SORT msg_files)

set(deprecated_msgs
ekf2_innovations.msg # 2019-11-22, Updated estimator interface and logging; replaced by 'estimator_innovations'.
)

foreach(msg IN LISTS deprecated_msgs)
if(msg IN_LIST msg_files)
get_filename_component(msg_we ${msg} NAME_WE)
list(APPEND invalid_msgs ${msg_we})
endif()
endforeach()
if(invalid_msgs)
list(LENGTH invalid_msgs invalid_msgs_size)
if(${invalid_msgs_size} GREATER 1)
foreach(msg IN LISTS invalid_msgs)
string(CONCAT invalid_msgs_cs ${invalid_msgs_cs} "'${msg}', ")
endforeach()
STRING(REGEX REPLACE ", +$" "" invalid_msgs_cs ${invalid_msgs_cs})
message(FATAL_ERROR "${invalid_msgs_cs} are listed as deprecated. Please use different names for the messages.")
else()
message(FATAL_ERROR "'${invalid_msgs}' is listed as deprecated. Please use a different name for the message.")
endif()
endif()

px4_list_make_absolute(msg_files ${CMAKE_CURRENT_SOURCE_DIR} ${msg_files})

if(NOT EXTERNAL_MODULES_LOCATION STREQUAL "")
Expand All @@ -287,90 +247,92 @@ endif()
# headers
set(msg_out_path ${PX4_BINARY_DIR}/uORB/topics)
set(ucdr_out_path ${PX4_BINARY_DIR}/uORB/ucdr)
set(msg_source_out_path ${CMAKE_CURRENT_BINARY_DIR}/topics_sources)
set(msg_source_out_path ${CMAKE_CURRENT_BINARY_DIR}/topics_sources)

set(uorb_headers ${msg_out_path}/uORBTopics.hpp)
set(uorb_sources ${msg_source_out_path}/uORBTopics.cpp)
set(uorb_headers)
set(uorb_sources)
set(uorb_ucdr_headers)
foreach(msg_file ${msg_files})
get_filename_component(msg ${msg_file} NAME_WE)

# Pascal case to snake case (MsgFile -> msg_file)
string(REGEX REPLACE "(.)([A-Z][a-z]+)" "\\1_\\2" msg "${msg}")
string(REGEX REPLACE "([a-z0-9])([A-Z])" "\\1_\\2" msg "${msg}")
string(TOLOWER "${msg}" msg)

list(APPEND uorb_headers ${msg_out_path}/${msg}.h)
list(APPEND uorb_sources ${msg_source_out_path}/${msg}.cpp)
list(APPEND uorb_ucdr_headers ${ucdr_out_path}/${msg}.h)
endforeach()

if (px4_constrained_flash_build)
set(added_arguments --constrained-flash)
endif()

# set parent scope msg_files for other modules to consume (eg topic_listener)
set(msg_files ${msg_files} PARENT_SCOPE)

# Generate uORB headers
add_custom_command(OUTPUT ${uorb_headers}
COMMAND ${PYTHON_EXECUTABLE} tools/px_generate_uorb_topic_files.py
add_custom_command(
OUTPUT
${uorb_headers}
${msg_out_path}/uORBTopics.hpp
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
--headers
-f ${msg_files}
-i ${CMAKE_CURRENT_SOURCE_DIR}
-o ${msg_out_path}
-e templates/uorb
-t ${CMAKE_CURRENT_BINARY_DIR}/tmp/headers
-q
${added_arguments}
-e ${PX4_SOURCE_DIR}/Tools/msg/templates/uorb
DEPENDS
${msg_files}
templates/uorb/msg.h.em
templates/uorb/uORBTopics.hpp.em
tools/px_generate_uorb_topic_files.py
tools/px_generate_uorb_topic_helper.py
${PX4_SOURCE_DIR}/Tools/msg/templates/uorb/msg.h.em
${PX4_SOURCE_DIR}/Tools/msg/templates/uorb/uORBTopics.hpp.em
${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_helper.py
COMMENT "Generating uORB topic headers"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
VERBATIM
)
add_custom_target(uorb_headers DEPENDS ${uorb_headers})

add_custom_command(OUTPUT ${uorb_ucdr_headers}
COMMAND ${PYTHON_EXECUTABLE} tools/px_generate_uorb_topic_files.py
# Generate microcdr headers
add_custom_command(
OUTPUT ${uorb_ucdr_headers}
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
--headers
-f ${msg_files}
-i ${CMAKE_CURRENT_SOURCE_DIR}
-o ${ucdr_out_path}
-e templates/ucdr
-t ${CMAKE_CURRENT_BINARY_DIR}/tmp/ucdr_headers
-q
${added_arguments}
-e ${PX4_SOURCE_DIR}/Tools/msg/templates/ucdr
DEPENDS
${msg_files}
templates/ucdr/msg.h.em
tools/px_generate_uorb_topic_files.py
tools/px_generate_uorb_topic_helper.py
${PX4_SOURCE_DIR}/Tools/msg/templates/ucdr/msg.h.em
${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_helper.py
COMMENT "Generating uORB topic ucdr headers"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
VERBATIM
)
add_custom_target(uorb_ucdr_headers DEPENDS ${uorb_ucdr_headers})

# Generate uORB sources
add_custom_command(OUTPUT ${uorb_sources}
COMMAND ${PYTHON_EXECUTABLE} tools/px_generate_uorb_topic_files.py
add_custom_command(
OUTPUT
${uorb_sources}
${msg_source_out_path}/uORBTopics.cpp
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
--sources
-f ${msg_files}
-i ${CMAKE_CURRENT_SOURCE_DIR}
-o ${msg_source_out_path}
-e templates/uorb
-t ${CMAKE_CURRENT_BINARY_DIR}/tmp/sources
-q
${added_arguments}
-e ${PX4_SOURCE_DIR}/Tools/msg/templates/uorb
DEPENDS
${msg_files}
templates/uorb/msg.cpp.em
templates/uorb/uORBTopics.cpp.em
tools/px_generate_uorb_topic_files.py
tools/px_generate_uorb_topic_helper.py
${PX4_SOURCE_DIR}/Tools/msg/templates/uorb/msg.cpp.em
${PX4_SOURCE_DIR}/Tools/msg/templates/uorb/uORBTopics.cpp.em
${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_files.py
${PX4_SOURCE_DIR}/Tools/msg/px_generate_uorb_topic_helper.py
COMMENT "Generating uORB topic sources"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
VERBATIM
)

add_library(uorb_msgs ${uorb_sources})
add_library(uorb_msgs ${uorb_headers} ${msg_out_path}/uORBTopics.hpp ${uorb_sources} ${msg_source_out_path}/uORBTopics.cpp)
target_link_libraries(uorb_msgs PRIVATE m)
add_dependencies(uorb_msgs prebuild_targets uorb_headers)
1 change: 1 addition & 0 deletions msg/TakeoffStatus.msg
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ uint8 TAKEOFF_STATE_RAMPUP = 4
uint8 TAKEOFF_STATE_FLIGHT = 5

uint8 takeoff_state
uint64 time_in_state

float32 tilt_limit # limited tilt feasibility during takeoff, contains maximum tilt otherwise
16 changes: 6 additions & 10 deletions src/modules/fw_pos_control/FixedwingPositionControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -700,14 +700,10 @@ FixedwingPositionControl::updateManualTakeoffStatus()
{

//TF CHECK
// a VTOL does not need special takeoff handling
if (_vehicle_status.is_vtol) {
return false;
}

if (_autogyro_takeoff.autogyroTakeoffEnabled()) {
return (!_autogyro_takeoff.isInitialized() || _autogyro_takeoff.climbout());
}
//
// if (_autogyro_takeoff.autogyroTakeoffEnabled()) {
// return (!_autogyro_takeoff.isInitialized() || _autogyro_takeoff.climbout());
// }
//TF CHECK
if (!_completed_manual_takeoff) {
const bool at_controllable_airspeed = _airspeed > _param_fw_airspd_min.get()
Expand All @@ -718,8 +714,8 @@ FixedwingPositionControl::updateManualTakeoffStatus()
}

// in air for < 10s
return (hrt_elapsed_time(&_time_went_in_air) < 10_s)
&& (_current_altitude <= _takeoff_ground_alt + _param_fw_clmbout_diff.get());
//return (hrt_elapsed_time(&_time_went_in_air) < 10_s)
// && (_current_altitude <= _takeoff_ground_alt + _param_fw_clmbout_diff.get());

}

Expand Down
19 changes: 9 additions & 10 deletions src/modules/fw_pos_control/FixedwingPositionControl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ class FixedwingPositionControl final : public ModuleBase<FixedwingPositionContro
// class handling runway takeoff for fixed-wing UAVs with steerable wheels
RunwayTakeoff _runway_takeoff;

AutogyroTakeoff _autogyro_takeoff;

bool _skipping_takeoff_detection{false};

// AUTO LANDING
Expand All @@ -342,13 +344,8 @@ class FixedwingPositionControl final : public ModuleBase<FixedwingPositionContro
// orbit to altitude only when the aircraft has entered the final *straight approach.
hrt_abstime _time_started_landing{0};

<<<<<<< HEAD
// [m] lateral touchdown position offset manually commanded during landing
float _lateral_touchdown_position_offset{0.0f};
=======
RunwayTakeoff _runway_takeoff;
AutogyroTakeoff _autogyro_takeoff;
>>>>>>> Autogyro takeoff, squash and clean

// [m] relative vector from land point to approach entrance (NE)
Vector2f _landing_approach_entrance_offset_vector{};
Expand Down Expand Up @@ -402,12 +399,12 @@ class FixedwingPositionControl final : public ModuleBase<FixedwingPositionContro

float _groundspeed_undershoot{0.0f}; ///< ground speed error to min. speed in m/s

float _roll{0.0f};
float _pitch{0.0f};
float _yaw{0.0f};
float _yawrate{0.0f};
//float _roll{0.0f};
//float _pitch{0.0f};
//float _yaw{0.0f};
//float _yawrate{0.0f};

// TECS
// TECS
// total energy control system - airspeed / altitude control
TECS _tecs;

Expand Down Expand Up @@ -874,6 +871,8 @@ class FixedwingPositionControl final : public ModuleBase<FixedwingPositionContro

DEFINE_PARAMETERS(

(ParamFloat<px4::params::FW_CLMBOUT_DIFF>) _param_fw_clmbout_diff,

(ParamFloat<px4::params::FW_AIRSPD_MAX>) _param_fw_airspd_max,
(ParamFloat<px4::params::FW_AIRSPD_MIN>) _param_fw_airspd_min,
(ParamFloat<px4::params::FW_AIRSPD_TRIM>) _param_fw_airspd_trim,
Expand Down
Loading

0 comments on commit 3bb2b1c

Please sign in to comment.