fixes for integration and unit tests

Move ros logs dir so that .ulg files are not in the same directory
(mission_test.py:: get_last_log() fails otherwise)
This commit is contained in:
Beat Küng 2018-08-06 14:13:00 +02:00 committed by Lorenz Meier
parent 0edd7c93e1
commit 5363aff879
9 changed files with 50 additions and 19 deletions

View File

@ -0,0 +1,25 @@
Multirotor mixer for TEST
===========================
This file defines a single mixer for a quadrotor with a wide configuration. All controls are mixed 100%.
R: 4w 10000 10000 10000 0
Gimbal / payload mixer for last four channels
-----------------------------------------------------
M: 1
O: 10000 10000 0 -10000 10000
S: 0 4 10000 10000 0 -10000 10000
M: 1
O: 10000 10000 0 -10000 10000
S: 0 5 10000 10000 0 -10000 10000
M: 1
O: 10000 10000 0 -10000 10000
S: 0 6 10000 10000 0 -10000 10000
M: 1
O: 10000 10000 0 -10000 10000
S: 0 7 10000 10000 0 -10000 10000

View File

@ -117,6 +117,8 @@ if [[ ($rcS_path == posix-configs/SITL/init/ekf2 || $rcS_path == posix-configs/S
&& ($model == "iris" || $model == "typhoon_h480") ]]; then
echo "Using new unified rcS for $model"
sitl_command="$sitl_bin $no_pxh $src_path/ROMFS/px4fmu_common -s etc/init.d-posix/rcS -t $src_path/test_data"
elif [[ ${model} == tests* ]]; then
sitl_command="$sitl_bin $no_pxh $src_path/ROMFS/px4fmu_test -s ${src_path}/${rcS_path}/${model} -t $src_path/test_data"
else
sitl_command="$sitl_bin $no_pxh $src_path/ROMFS/px4fmu_common -s ${src_path}/${rcS_path}/${model} -t $src_path/test_data"
fi

View File

@ -60,8 +60,10 @@ def get_last_log():
try:
log_path = os.environ['PX4_LOG_DIR']
except KeyError:
log_path = os.path.join(os.environ['HOME'],
'.ros/rootfs/fs/microsd/log')
try:
log_path = os.path.join(os.environ['ROS_HOME'], 'log')
except KeyError:
log_path = os.path.join(os.environ['HOME'], '.ros/log')
last_log_dir = sorted(glob.glob(os.path.join(log_path, '*')))[-1]
last_log = sorted(glob.glob(os.path.join(last_log_dir, '*.ulg')))[-1]
return last_log

View File

@ -321,8 +321,17 @@ int create_symlinks_if_needed(std::string &data_path)
std::string src_path = data_path;
std::string dest_path = current_path + "/" + path_sym_link;
if (dir_exists(dest_path)) {
return PX4_OK;
struct stat info;
if (lstat(dest_path.c_str(), &info) == 0) {
if (S_ISLNK(info.st_mode)) {
// recreate the symlink, as it might point to some other location than what we want now
unlink(dest_path.c_str());
} else if (S_ISDIR(info.st_mode)) {
return PX4_OK;
}
}
PX4_INFO("Creating symlink %s -> %s", src_path.c_str(), dest_path.c_str());
@ -614,9 +623,9 @@ bool dir_exists(const std::string &path)
} else if (info.st_mode & S_IFDIR) {
return true;
} else {
return false;
}
return false;
}
std::string pwd()

View File

@ -21,11 +21,6 @@ pwm_out_sim start
ver all
list_tasks
list_devices
list_topics
list_files
mavlink start -x -u 14556 -r 2000000
mavlink boot_complete

View File

@ -21,11 +21,6 @@ pwm_out_sim start
ver all
list_tasks
list_devices
list_topics
list_files
mavlink start -x -u 14556 -r 2000000
mavlink boot_complete

View File

@ -45,7 +45,7 @@
#ifdef __PX4_NUTTX
#define PX4_MAVLINK_TEST_DATA_DIR "/etc"
#else
#define PX4_MAVLINK_TEST_DATA_DIR "ROMFS/px4fmu_test"
#define PX4_MAVLINK_TEST_DATA_DIR "etc"
#endif
/// @brief Test case file name for Read command. File are generated using mavlink_ftp_test_data.py

View File

@ -79,8 +79,8 @@ static bool should_prearm = false;
#endif
#if defined(CONFIG_ARCH_BOARD_SITL)
#define MIXER_PATH(_file) "ROMFS/px4fmu_test/mixers/"#_file
#define MIXER_ONBOARD_PATH "ROMFS/px4fmu_common/mixers"
#define MIXER_PATH(_file) "etc/mixers/"#_file
#define MIXER_ONBOARD_PATH "etc/mixers"
#else
#define MIXER_ONBOARD_PATH "/etc/mixers"
#define MIXER_PATH(_file) MIXER_ONBOARD_PATH"/"#_file

View File

@ -8,4 +8,7 @@ source ${PX4_SRC_DIR}/Tools/setup_gazebo.bash ${PX4_SRC_DIR} ${PX4_SRC_DIR}/buil
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:${PX4_SRC_DIR}:${PX4_SRC_DIR}/Tools/sitl_gazebo
export ROS_LOG_DIR="$HOME/.ros/ros_logs"
mkdir -p "$ROS_LOG_DIR"
rostest px4 "$@"