<commit_before>/****************************************************************************
 *
 *   Copyright (c) 2019 PX4 Development Team. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 * 3. Neither the name PX4 nor the names of its contributors may be
 *    used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 ****************************************************************************/

#include "logged_topics.h"
#include "messages.h"

#include <parameters/param.h>
#include <px4_platform_common/log.h>
#include <px4_platform_common/px4_config.h>
#include <uORB/topics/uORBTopics.hpp>

#include <string.h>

using namespace px4::logger;

void LoggedTopics::add_default_topics()
{
	add_topic("actuator_armed");
	add_topic("actuator_controls_0", 50);
	add_topic("actuator_controls_1", 100);
	add_topic("actuator_controls_2", 100);
	add_topic("actuator_controls_3", 100);
	add_topic("actuator_controls_4", 100);
	add_topic("actuator_controls_5", 100);
	add_topic("airspeed", 1000);
	add_topic("airspeed_validated", 200);
	add_topic("camera_capture");
	add_topic("camera_trigger");
	add_topic("camera_trigger_secondary");
	add_topic("cellular_status", 200);
	add_topic("commander_state");
	add_topic("cpuload");
	add_topic("esc_status", 250);
	add_topic("generator_status");
	add_topic("heater_status");
	add_topic("home_position");
	add_topic("hover_thrust_estimate", 100);
	add_topic("input_rc", 500);
	add_topic("mag_worker_data");
	add_topic("manual_control_setpoint", 200);
	add_topic("manual_control_switches");
	add_topic("mission");
	add_topic("mission_result");
	add_topic("navigator_mission_item");
	add_topic("offboard_control_mode", 100);
	add_topic("onboard_computer_status", 10);
	add_topic("parameter_update");
	add_topic("position_controller_status", 500);
	add_topic("position_setpoint_triplet", 200);
	add_topic("px4io_status");
	add_topic("radio_status");
	add_topic("rpm", 500);
	add_topic("rtl_flight_time", 1000);
	add_topic("safety");
	add_topic("sensor_combined");
	add_topic("sensor_correction");
	add_topic("sensor_gyro_fft", 50);
	add_topic("sensor_preflight_mag", 500);
	add_topic("sensor_selection");
	add_topic("sensors_status_imu", 200);
	add_topic("system_power", 500);
	add_topic("takeoff_status", 1000);
	add_topic("tecs_status", 200);
	add_topic("test_motor", 500);
	add_topic("trajectory_setpoint", 200);
	add_topic("transponder_report");
	add_topic("vehicle_acceleration", 50);
	add_topic("vehicle_air_data", 200);
	add_topic("vehicle_angular_velocity", 20);
	add_topic("vehicle_attitude", 50);
	add_topic("vehicle_attitude_setpoint", 50);
	add_topic("vehicle_command");
	add_topic("vehicle_constraints", 1000);
	add_topic("vehicle_control_mode");
	add_topic("vehicle_global_position", 200);
	add_topic("vehicle_gps_position", 500);
	add_topic("vehicle_land_detected");
	add_topic("vehicle_local_position", 100);
	add_topic("vehicle_local_position_setpoint", 100);
	add_topic("vehicle_magnetometer", 200);
	add_topic("vehicle_rates_setpoint", 20);
	add_topic("vehicle_roi", 1000);
	add_topic("vehicle_status");
	add_topic("vehicle_status_flags");
	add_topic("vtol_vehicle_status", 200);
	add_topic("wind", 1000);

	// Control allocation topics
	add_topic("vehicle_angular_acceleration_setpoint", 20);
	add_topic("vehicle_angular_acceleration", 20);
	add_topic("vehicle_thrust_setpoint", 20);
	add_topic("vehicle_torque_setpoint", 20);
	add_topic("vehicle_actuator_setpoint", 20);

	// multi topics
	add_topic_multi("actuator_outputs", 100, 3);
	add_topic_multi("airspeed_wind", 1000);
	add_topic_multi("logger_status", 0, 2);
	add_topic_multi("multirotor_motor_limits", 1000, 2);
	add_topic_multi("rate_ctrl_status", 200, 2);
	add_topic_multi("telemetry_status", 1000, 4);

	// EKF multi topics (currently max 9 estimators)
#if CONSTRAINED_MEMORY
	static constexpr uint8_t MAX_ESTIMATOR_INSTANCES = 2;
#else
	static constexpr uint8_t MAX_ESTIMATOR_INSTANCES = 6; // artificailly limited until PlotJuggler fixed
#endif

	add_topic("estimator_selector_status");
	add_topic_multi("ekf_gps_drift", 1000, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_attitude", 500, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_event_flags", 0, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_global_position", 1000, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_innovation_test_ratios", 500, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_innovation_variances", 500, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_innovations", 500, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_local_position", 500, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_optical_flow_vel", 200, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_sensor_bias", 0, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_states", 1000, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_status", 200, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_status_flags", 0, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_visual_odometry_aligned", 200, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_wind", 1000, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("yaw_estimator_status", 1000, MAX_ESTIMATOR_INSTANCES);

	// log all raw sensors at minimal rate (at least 1 Hz)
	add_topic_multi("battery_status", 200, 2);
	add_topic_multi("differential_pressure", 1000, 2);
	add_topic_multi("distance_sensor", 1000);
	add_topic_multi("optical_flow", 1000, 1);
	add_topic_multi("sensor_accel", 1000, 4);
	add_topic_multi("sensor_baro", 1000, 4);
	add_topic_multi("sensor_gps", 1000, 2);
	add_topic_multi("sensor_gyro", 1000, 4);
	add_topic_multi("sensor_mag", 1000, 4);
	add_topic_multi("vehicle_imu", 500, 4);
	add_topic_multi("vehicle_imu_status", 1000, 4);
	add_topic_multi("vehicle_magnetometer", 500, 4);<commit_msg>logger: skip multi-EKF logging if CONSTRAINED_MEMORY<commit_after>/****************************************************************************
 *
 *   Copyright (c) 2019 PX4 Development Team. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 * 3. Neither the name PX4 nor the names of its contributors may be
 *    used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 ****************************************************************************/

#include "logged_topics.h"
#include "messages.h"

#include <parameters/param.h>
#include <px4_platform_common/log.h>
#include <px4_platform_common/px4_config.h>
#include <uORB/topics/uORBTopics.hpp>

#include <string.h>

using namespace px4::logger;

void LoggedTopics::add_default_topics()
{
	add_topic("actuator_armed");
	add_topic("actuator_controls_0", 50);
	add_topic("actuator_controls_1", 100);
	add_topic("actuator_controls_2", 100);
	add_topic("actuator_controls_3", 100);
	add_topic("actuator_controls_4", 100);
	add_topic("actuator_controls_5", 100);
	add_topic("airspeed", 1000);
	add_topic("airspeed_validated", 200);
	add_topic("camera_capture");
	add_topic("camera_trigger");
	add_topic("camera_trigger_secondary");
	add_topic("cellular_status", 200);
	add_topic("commander_state");
	add_topic("cpuload");
	add_topic("esc_status", 250);
	add_topic("generator_status");
	add_topic("heater_status");
	add_topic("home_position");
	add_topic("hover_thrust_estimate", 100);
	add_topic("input_rc", 500);
	add_topic("mag_worker_data");
	add_topic("manual_control_setpoint", 200);
	add_topic("manual_control_switches");
	add_topic("mission");
	add_topic("mission_result");
	add_topic("navigator_mission_item");
	add_topic("offboard_control_mode", 100);
	add_topic("onboard_computer_status", 10);
	add_topic("parameter_update");
	add_topic("position_controller_status", 500);
	add_topic("position_setpoint_triplet", 200);
	add_topic("px4io_status");
	add_topic("radio_status");
	add_topic("rpm", 500);
	add_topic("rtl_flight_time", 1000);
	add_topic("safety");
	add_topic("sensor_combined");
	add_topic("sensor_correction");
	add_topic("sensor_gyro_fft", 50);
	add_topic("sensor_preflight_mag", 500);
	add_topic("sensor_selection");
	add_topic("sensors_status_imu", 200);
	add_topic("system_power", 500);
	add_topic("takeoff_status", 1000);
	add_topic("tecs_status", 200);
	add_topic("test_motor", 500);
	add_topic("trajectory_setpoint", 200);
	add_topic("transponder_report");
	add_topic("vehicle_acceleration", 50);
	add_topic("vehicle_air_data", 200);
	add_topic("vehicle_angular_velocity", 20);
	add_topic("vehicle_attitude", 50);
	add_topic("vehicle_attitude_setpoint", 50);
	add_topic("vehicle_command");
	add_topic("vehicle_constraints", 1000);
	add_topic("vehicle_control_mode");
	add_topic("vehicle_global_position", 200);
	add_topic("vehicle_gps_position", 500);
	add_topic("vehicle_land_detected");
	add_topic("vehicle_local_position", 100);
	add_topic("vehicle_local_position_setpoint", 100);
	add_topic("vehicle_magnetometer", 200);
	add_topic("vehicle_rates_setpoint", 20);
	add_topic("vehicle_roi", 1000);
	add_topic("vehicle_status");
	add_topic("vehicle_status_flags");
	add_topic("vtol_vehicle_status", 200);
	add_topic("wind", 1000);

	// Control allocation topics
	add_topic("vehicle_actuator_setpoint", 20);
	add_topic("vehicle_angular_acceleration", 20);
	add_topic("vehicle_angular_acceleration_setpoint", 20);
	add_topic("vehicle_thrust_setpoint", 20);
	add_topic("vehicle_torque_setpoint", 20);

	// multi topics
	add_topic_multi("actuator_outputs", 100, 3);
	add_topic_multi("airspeed_wind", 1000);
	add_topic_multi("logger_status", 0, 2);
	add_topic_multi("multirotor_motor_limits", 1000, 2);
	add_topic_multi("rate_ctrl_status", 200, 2);
	add_topic_multi("telemetry_status", 1000, 4);

	// EKF multi topics (currently max 9 estimators)
#if CONSTRAINED_MEMORY
	static constexpr uint8_t MAX_ESTIMATOR_INSTANCES = 1;
#else
	static constexpr uint8_t MAX_ESTIMATOR_INSTANCES = 6; // artificailly limited until PlotJuggler fixed
	add_topic("estimator_selector_status");
	add_topic_multi("estimator_attitude", 500, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_global_position", 1000, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_local_position", 500, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_wind", 1000, MAX_ESTIMATOR_INSTANCES);
#endif

	add_topic_multi("ekf_gps_drift", 1000, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_event_flags", 0, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_innovation_test_ratios", 500, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_innovation_variances", 500, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_innovations", 500, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_optical_flow_vel", 200, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_sensor_bias", 0, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_states", 1000, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_status", 200, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_status_flags", 0, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("estimator_visual_odometry_aligned", 200, MAX_ESTIMATOR_INSTANCES);
	add_topic_multi("yaw_estimator_status", 1000, MAX_ESTIMATOR_INSTANCES);

	// log all raw sensors at minimal rate (at least 1 Hz)
	add_topic_multi("battery_status", 200, 2);
	add_topic_multi("differential_pressure", 1000, 2);
	add_topic_multi("distance_sensor", 1000);
	add_topic_multi("optical_flow", 1000, 1);
	add_topic_multi("sensor_accel", 1000, 4);
	add_topic_multi("sensor_baro", 1000, 4);
	add_topic_multi("sensor_gps", 1000, 2);
	add_topic_multi("sensor_gyro", 1000, 4);
	add_topic_multi("sensor_mag", 1000, 4);
	add_topic_multi("vehicle_imu", 500, 4);
	add_topic_multi("vehicle_imu_status", 1000, 4);
	add_topic_multi("vehicle_magnetometer", 500, 4);
{'fraction_non_alphanumeric': 0.13276500593948712, 'fraction_numerical': 0.04010900705750821, 'mean_word_length': 8.434410019775873, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4211880', 'n_tokens_mistral': 5505, 'n_tokens_neox': 4690, 'n_words': 1016}