Skip to content

Commit 129c315

Browse files
committed
WIP: use new CA topic instead of actuator_outputs/controls
Signed-off-by: Silvan Fuhrer <[email protected]>
1 parent d0e743d commit 129c315

File tree

4 files changed

+72
-36
lines changed

4 files changed

+72
-36
lines changed

Tools/parametric_model/configs/standardplane_model.yaml

Lines changed: 57 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ model_config:
1717
- rotor_4:
1818
description: "puller rotor"
1919
rotor_type: "RotorModel"
20-
dataframe_name: "u4"
20+
dataframe_name: "u_motor"
2121
rotor_axis:
2222
- 1
2323
- 0
@@ -32,19 +32,19 @@ model_config:
3232
wing_:
3333
- control_surface_0:
3434
description: "aileron_right"
35-
dataframe_name: "u6"
35+
dataframe_name: "u_aileron"
3636

3737
- control_surface_1:
3838
description: "aileron_left"
39-
dataframe_name: "u5"
39+
dataframe_name: "u_aileron"
4040

4141
- control_surface_2:
4242
description: "elevator"
43-
dataframe_name: "u7"
43+
dataframe_name: "u_elevator"
4444

4545
- control_surface_3:
4646
description: "rudder"
47-
dataframe_name: "u2"
47+
dataframe_name: "u_rudder"
4848

4949
# - control_surface_4:
5050
# description: "flaps"
@@ -110,31 +110,61 @@ dynamics_model_config:
110110
estimate_angular_acceleration: False
111111
data:
112112
required_ulog_topics:
113-
actuator_outputs:
113+
vehicle_thrust_setpoint:
114114
ulog_name:
115115
- "timestamp"
116-
- "output[2]" # Rudder
117-
# - "output[3]" # Flaps
118-
- "output[4]" # motor
119-
- "output[5]" # left aileron
120-
- "output[6]" # right aileron
121-
- "output[7]" # elevator
116+
- "xyz[0]" # thrust in x
122117
dataframe_name:
123118
- "timestamp"
124-
- "u2"
125-
# - "u3"
126-
- "u4"
127-
- "u5"
128-
- "u6"
129-
- "u7"
119+
- "u_motor"
130120
actuator_type:
131121
- "timestamp"
132-
- "control_surface"
133-
# - "control_surface"
134122
- "motor"
123+
vehicle_torque_setpoint:
124+
ulog_name:
125+
- "timestamp"
126+
- "xyz[0]" # torque in x
127+
- "xyz[1]" # torque in y
128+
- "xyz[2]" # torque in z
129+
dataframe_name:
130+
- "timestamp"
131+
- "u_aileron"
132+
- "u_elevator"
133+
- "u_rudder"
134+
actuator_type:
135+
- "timestamp"
135136
- "control_surface"
136137
- "control_surface"
137138
- "control_surface"
139+
# actuator_motors:
140+
# ulog_name:
141+
# - "timestamp"
142+
# - "control[0]"
143+
# dataframe_name:
144+
# - "timestamp"
145+
# - "u_motor"
146+
# actuator_type:
147+
# - "timestamp"
148+
# - "motor"
149+
# actuator_servos:
150+
# ulog_name:
151+
# - "timestamp"
152+
# - "control[0]"
153+
# - "control[1]"
154+
# - "control[2]"
155+
# - "control[3]"
156+
# dataframe_name:
157+
# - "timestamp"
158+
# - "u_aileron_left"
159+
# - "u_aileron_right"
160+
# - "u_elevator_new"
161+
# - "u_rudder_new"
162+
# actuator_type:
163+
# - "timestamp"
164+
# - "control_surface"
165+
# - "control_surface"
166+
# - "control_surface"
167+
# - "control_surface"
138168
vehicle_local_position:
139169
ulog_name:
140170
- "timestamp"
@@ -182,3 +212,10 @@ dynamics_model_config:
182212
- "ang_acc_b_x"
183213
- "ang_acc_b_y"
184214
- "ang_acc_b_z"
215+
vehicle_land_detected:
216+
ulog_name:
217+
- "timestamp"
218+
- "landed"
219+
dataframe_name:
220+
- "timestamp"
221+
- "landed"

Tools/parametric_model/src/models/dynamics_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def __init__(self, config_dict):
8686

8787
def prepare_regression_matrices(self):
8888
if "V_air_body_x" not in self.data_df:
89-
self.normalize_actuators()
89+
# self.normalize_actuators()
9090
self.compute_airspeed_from_groundspeed(["vx", "vy", "vz"])
9191

9292
# Rotor features

Tools/parametric_model/src/tools/data_handler.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,7 @@ def compute_resampled_dataframe(self, ulog):
162162
else:
163163
curr_df = pandas_from_topic(ulog, [topic_type])
164164

165-
if topic_type == "actuator_outputs":
166-
fts = compute_flight_time(curr_df)
167-
elif topic_type == "actuator_controls_0":
165+
if topic_type == "vehicle_land_detected":
168166
fts = compute_flight_time(curr_df)
169167

170168
curr_df = curr_df[topic_dict["ulog_name"]]

Tools/parametric_model/src/tools/dataframe_tools.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,23 @@
4141
from src.tools.ulog_tools import pandas_from_topic
4242
from src.tools.quat_utils import slerp
4343

44-
# pre normalization thresholds
45-
PWM_THRESHOLD = 1000
46-
ACTUATOR_CONTROLS_THRESHOLD = -0.2
47-
4844

4945
def compute_flight_time(act_df, pwm_threshold=None, control_threshold=None):
50-
"""This function computes the flight time by a simple thresholding of actuator outputs or control values.
51-
This works usually well for logs from the simulator or mission flights. But in some cases the assumption of an actuator output staying higher than the trsehhold for the hole flight might not be valid."""
46+
"""This function computes the flight time by:
47+
Option 1: listen to vehicle_land_detected/landed
48+
Option 2: user defined start/end time stamp (micro seconds)
49+
"""
5250

53-
if pwm_threshold is None:
54-
pwm_threshold = PWM_THRESHOLD
51+
# # Option 1:
52+
# print("act_df: ", act_df)
53+
# act_df_crp = act_df[act_df.iloc[:, 4] < 1] # take part where landed is 0
54+
# print("act_df_crp after selection: ", act_df_crp)
5555

56-
if control_threshold is None:
57-
control_threshold = ACTUATOR_CONTROLS_THRESHOLD
58-
act_df_crp = act_df[act_df.iloc[:, 2] > pwm_threshold]
59-
act_df_crp = act_df[act_df.iloc[:, 4] > pwm_threshold]
56+
# Option 2:
57+
# print("act_df: ", act_df)
58+
act_df_crp = act_df[act_df.iloc[:, 0] > 405000000]
59+
act_df_crp = act_df_crp[act_df_crp.iloc[:, 0] < 430000000]
60+
# print("act_df_crp after selection: ", act_df_crp)
6061

6162
t_start = act_df_crp.iloc[1, 0]
6263
t_end = act_df_crp.iloc[(act_df_crp.shape[0]-1), 0]

0 commit comments

Comments
 (0)