Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def open_file(arq):
class dados:
class param:
pass
# Carrega Mensagens
msg=['vehicle_attitude','vehicle_attitude_setpoint','actuator_controls_0','vehicle_rates_setpoint'];
ulog = pyulog.ULog(arq, msg)
dados.param.r_r_p=ulog.initial_parameters['MC_ROLLRATE_P']
dados.param.r_r_i=ulog.initial_parameters['MC_ROLLRATE_I']
dados.param.r_r_d=ulog.initial_parameters['MC_ROLLRATE_D']
dados.param.r_p_p=ulog.initial_parameters['MC_PITCHRATE_P']
dados.param.r_p_i=ulog.initial_parameters['MC_PITCHRATE_I']
dados.param.r_p_d=ulog.initial_parameters['MC_PITCHRATE_D']
dados.param.r_y_p=ulog.initial_parameters['MC_YAWRATE_P']
dados.param.r_y_i=ulog.initial_parameters['MC_YAWRATE_I']
dados.param.r_y_d=ulog.initial_parameters['MC_YAWRATE_D']
dados.param.a_r_p=ulog.initial_parameters['MC_ROLL_P']
dados.param.a_p_p=ulog.initial_parameters['MC_PITCH_P']
dados.param.a_y_p=ulog.initial_parameters['MC_YAW_P']
def read_ulog(ulog_filename, messages=None):
"""
Convert ulog to pandas dataframe.
"""
log = pyulog.ULog(ulog_filename, messages)
# column naming
d_col_rename = {
'[': '_',
']': '_',
'.': '_',
}
col_rename_pattern = re.compile(
r'(' + '|'.join([
re.escape(key)
for key in d_col_rename.keys()]) + r')')
data = {}
for msg in log.data_list:
msg_data = pd.DataFrame.from_dict(msg.data)
msg_data.columns = [
def open_file(arq):
class dados:
class param:
pass
# Carrega Mensagens
msg=['vehicle_attitude','vehicle_attitude_setpoint','actuator_controls_0','vehicle_rates_setpoint'];
ulog = pyulog.ULog(arq, msg)
dados.param.r_r_p=ulog.initial_parameters['MC_ROLLRATE_P']
dados.param.r_r_i=ulog.initial_parameters['MC_ROLLRATE_I']
dados.param.r_r_d=ulog.initial_parameters['MC_ROLLRATE_D']
dados.param.r_p_p=ulog.initial_parameters['MC_PITCHRATE_P']
dados.param.r_p_i=ulog.initial_parameters['MC_PITCHRATE_I']
dados.param.r_p_d=ulog.initial_parameters['MC_PITCHRATE_D']
dados.param.r_y_p=ulog.initial_parameters['MC_YAWRATE_P']
dados.param.r_y_i=ulog.initial_parameters['MC_YAWRATE_I']
dados.param.r_y_d=ulog.initial_parameters['MC_YAWRATE_D']
dados.param.a_r_p=ulog.initial_parameters['MC_ROLL_P']
dados.param.a_p_p=ulog.initial_parameters['MC_PITCH_P']
dados.param.a_y_p=ulog.initial_parameters['MC_YAW_P']
def process_logdata_ekf(
filename: str, check_level_dict_filename: str, check_table_filename: str,
plot: bool = True, sensor_safety_margins: bool = True):
## load the log and extract the necessary data for the analyses
try:
ulog = ULog(filename)
except:
raise PreconditionError('could not open {:s}'.format(filename))
try:
# get the dictionary of fail and warning test thresholds from a csv file
with open(check_level_dict_filename, 'r') as file:
reader = csv.DictReader(file)
check_levels = {row['check_id']: float(row['threshold']) for row in reader}
print('Using test criteria loaded from {:s}'.format(check_level_dict_filename))
except:
raise PreconditionError('could not find {:s}'.format(check_level_dict_filename))
in_air_margin = 5.0 if sensor_safety_margins else 0.0
# perform the ekf analysis
master_status, check_status, metrics, airtime_info = analyse_ekf(
ulog, check_levels, red_thresh=1.0, amb_thresh=0.5, min_flight_duration_seconds=5.0,