generated from ut-issl/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #546 from ut-issl/develop
Merge develop to main for Minor update v7.1.0
- Loading branch information
Showing
56 changed files
with
7,923 additions
and
416 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
data/sample/initialize_files/components/angular_velocity_observer.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[COMPONENT_BASE] | ||
prescaler = 1 | ||
|
||
[SENSOR_BASE_ANGULAR_VELOCITY_OBSERVER] | ||
// Constant bias noise at component frame [rad/s] | ||
constant_bias_c_rad_s(0) = 0.0 | ||
constant_bias_c_rad_s(1) = 0.0 | ||
constant_bias_c_rad_s(2) = 0.0 | ||
|
||
// Standard deviation for random walk noise[rad/s] | ||
random_walk_standard_deviation_c_rad_s(0) = 0.0 | ||
random_walk_standard_deviation_c_rad_s(1) = 0.0 | ||
random_walk_standard_deviation_c_rad_s(2) = 0.0 | ||
|
||
// Limit of random walk noise[rad/s] | ||
random_walk_limit_c_rad_s(0) = 0.0 | ||
random_walk_limit_c_rad_s(1) = 0.0 | ||
random_walk_limit_c_rad_s(2) = 0.0 | ||
|
||
// Standard deviation of normal random noise[rad/s] | ||
normal_random_standard_deviation_c_rad_s(0) = 1e-3 | ||
normal_random_standard_deviation_c_rad_s(1) = 1e-3 | ||
normal_random_standard_deviation_c_rad_s(2) = 1e-3 | ||
|
||
// Range [rad/s] | ||
range_to_constant_rad_s = 5.0 // smaller than range_to_zero | ||
range_to_zero_rad_s = 10.0 |
7 changes: 7 additions & 0 deletions
7
data/sample/initialize_files/components/attitude_observer.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[ATTITUDE_OBSERVER] | ||
// Standard deviation of force direction error [deg] | ||
error_angle_standard_deviation_deg = 1 | ||
|
||
[COMPONENT_BASE] | ||
// Prescaler with respect to the component update period | ||
prescaler = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# | ||
# Plot Angular Velocity Observer | ||
# | ||
# arg[1] : read_file_tag : time tag for default CSV output log file. ex. 220627_142946 | ||
# | ||
|
||
# | ||
# Import | ||
# | ||
# plots | ||
import matplotlib.pyplot as plt | ||
# local function | ||
from common import find_latest_log_tag | ||
from common import add_log_file_arguments | ||
from common import read_3d_vector_from_csv | ||
from common import read_scalar_from_csv | ||
# arguments | ||
import argparse | ||
|
||
# Arguments | ||
aparser = argparse.ArgumentParser() | ||
aparser = add_log_file_arguments(aparser) | ||
aparser.add_argument('--no-gui', action='store_true') | ||
args = aparser.parse_args() | ||
|
||
# | ||
# Read Arguments | ||
# | ||
# log file path | ||
path_to_logs = args.logs_dir | ||
|
||
read_file_tag = args.file_tag | ||
if read_file_tag == None: | ||
print("file tag does not found. use latest.") | ||
read_file_tag = find_latest_log_tag(path_to_logs) | ||
|
||
print("log: " + read_file_tag) | ||
|
||
# | ||
# CSV file name | ||
# | ||
read_file_name = path_to_logs + '/' + 'logs_' + read_file_tag + '/' + read_file_tag + '_default.csv' | ||
|
||
# | ||
# Data read and edit | ||
# | ||
# Read S2E CSV | ||
time = read_scalar_from_csv(read_file_name, 'elapsed_time[s]') | ||
|
||
measured_angular_velocity_b_rad_s = read_3d_vector_from_csv(read_file_name, 'angular_velocity_observer_measured_value_b', 'rad/s') | ||
true_angular_velocity_b_rad_s = read_3d_vector_from_csv(read_file_name, 'spacecraft_angular_velocity_b', 'rad/s') | ||
|
||
# Statistics | ||
# We assume that the component frame and the body frame is same | ||
error_rad_s = measured_angular_velocity_b_rad_s - true_angular_velocity_b_rad_s | ||
average = [0.0, 0.0, 0.0] | ||
standard_deviation = [0.0, 0.0, 0.0] | ||
for i in range(3): | ||
average[i] = error_rad_s[i].mean() | ||
standard_deviation[i] = error_rad_s[i].std() | ||
|
||
# | ||
# Plot | ||
# | ||
unit = ' rad/s' | ||
|
||
fig, axis = plt.subplots(3, 1, squeeze = False, tight_layout = True, sharex = True) | ||
axis[0, 0].plot(time[0], measured_angular_velocity_b_rad_s[0], marker=".", c="red", label="MEASURED-X") | ||
axis[0, 0].plot(time[0], true_angular_velocity_b_rad_s[0], marker=".", c="orange", label="TRUE-X") | ||
axis[0, 0].legend(loc = 'upper right') | ||
axis[0, 0].text(0.01, 0.99, "Error average:" + format(average[0], '+.2e') + unit, verticalalignment = 'top', transform = axis[0, 0].transAxes) | ||
axis[0, 0].text(0.01, 0.89, "Standard deviation:" + format(standard_deviation[0], '+.2e') + unit, verticalalignment = 'top', transform = axis[0, 0].transAxes) | ||
|
||
axis[1, 0].plot(time[0], measured_angular_velocity_b_rad_s[1], marker=".", c="green", label="MEASURED-Y") | ||
axis[1, 0].plot(time[0], true_angular_velocity_b_rad_s[1], marker=".", c="yellow", label="TRUE-Y") | ||
axis[1, 0].legend(loc = 'upper right') | ||
axis[1, 0].text(0.01, 0.99, "Error average:" + format(average[1], '+.2e') + unit, verticalalignment = 'top', transform = axis[1, 0].transAxes) | ||
axis[1, 0].text(0.01, 0.89, "Standard deviation:" + format(standard_deviation[1], '+.2e') + unit, verticalalignment = 'top', transform = axis[1, 0].transAxes) | ||
|
||
axis[2, 0].plot(time[0], measured_angular_velocity_b_rad_s[2], marker=".", c="blue", label="MEASURED-Z") | ||
axis[2, 0].plot(time[0], true_angular_velocity_b_rad_s[2], marker=".", c="purple", label="TRUE-Z") | ||
axis[2, 0].legend(loc = 'upper right') | ||
axis[2, 0].text(0.01, 0.99, "Error average:" + format(average[2], '+.2e') + unit, verticalalignment = 'top', transform = axis[2, 0].transAxes) | ||
axis[2, 0].text(0.01, 0.89, "Standard deviation:" + format(standard_deviation[2], '+.2e') + unit, verticalalignment = 'top', transform = axis[2, 0].transAxes) | ||
|
||
fig.suptitle("Angular Velocity Observer") | ||
fig.supylabel("Angular Velocity" + unit) | ||
fig.supxlabel("Time [s]") | ||
|
||
# Data save | ||
if args.no_gui: | ||
plt.savefig(read_file_tag + "_angular_velocity_observer.png") # save last figure only | ||
else: | ||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# | ||
# Plot Attitude Observer | ||
# | ||
# arg[1] : read_file_tag : time tag for default CSV output log file. ex. 220627_142946 | ||
# | ||
|
||
# | ||
# Import | ||
# | ||
# plots | ||
import matplotlib.pyplot as plt | ||
# local function | ||
from common import find_latest_log_tag | ||
from common import add_log_file_arguments | ||
from common import read_quaternion_from_csv | ||
from common import read_scalar_from_csv | ||
from common import calc_error_angle_from_quaternions | ||
# arguments | ||
import argparse | ||
|
||
# Arguments | ||
aparser = argparse.ArgumentParser() | ||
aparser = add_log_file_arguments(aparser) | ||
aparser.add_argument('--no-gui', action='store_true') | ||
args = aparser.parse_args() | ||
|
||
# | ||
# Read Arguments | ||
# | ||
# log file path | ||
path_to_logs = args.logs_dir | ||
|
||
read_file_tag = args.file_tag | ||
if read_file_tag == None: | ||
print("file tag does not found. use latest.") | ||
read_file_tag = find_latest_log_tag(path_to_logs) | ||
|
||
print("log: " + read_file_tag) | ||
|
||
# | ||
# CSV file name | ||
# | ||
read_file_name = path_to_logs + '/' + 'logs_' + read_file_tag + '/' + read_file_tag + '_default.csv' | ||
|
||
# | ||
# Data read and edit | ||
# | ||
# Read S2E CSV | ||
time = read_scalar_from_csv(read_file_name, 'elapsed_time[s]') | ||
|
||
measured_quaternion_i2b = read_quaternion_from_csv(read_file_name, 'attitude_observer_quaternion_i2b') | ||
true_quaternion_i2b = read_quaternion_from_csv(read_file_name, 'spacecraft_quaternion_i2b') | ||
|
||
# Statistics | ||
error_angle_rad = calc_error_angle_from_quaternions(measured_quaternion_i2b, true_quaternion_i2b) | ||
error_average = error_angle_rad.mean() | ||
standard_deviation = error_angle_rad.std() | ||
|
||
# | ||
# Plot | ||
# | ||
|
||
fig, axis = plt.subplots(4, 1, squeeze = False, tight_layout = True, sharex = True) | ||
axis[0, 0].plot(time[0], measured_quaternion_i2b[0], marker=".", c="red", label="MEASURED-X") | ||
axis[0, 0].plot(time[0], true_quaternion_i2b[0], marker=".", c="orange", label="TRUE-X") | ||
axis[0, 0].legend(loc = 'upper right') | ||
|
||
axis[1, 0].plot(time[0], measured_quaternion_i2b[1], marker=".", c="green", label="MEASURED-Y") | ||
axis[1, 0].plot(time[0], true_quaternion_i2b[1], marker=".", c="yellow", label="TRUE-Y") | ||
axis[1, 0].legend(loc = 'upper right') | ||
|
||
axis[2, 0].plot(time[0], measured_quaternion_i2b[2], marker=".", c="blue", label="MEASURED-Z") | ||
axis[2, 0].plot(time[0], true_quaternion_i2b[2], marker=".", c="purple", label="TRUE-Z") | ||
axis[2, 0].legend(loc = 'upper right') | ||
|
||
axis[3, 0].plot(time[0], measured_quaternion_i2b[3], marker=".", c="black", label="MEASURED-W") | ||
axis[3, 0].plot(time[0], true_quaternion_i2b[3], marker=".", c="gray", label="TRUE-W") | ||
axis[3, 0].legend(loc = 'upper right') | ||
|
||
fig.suptitle("Attitude Observer Quaternion") | ||
fig.supylabel("Quaternion") | ||
fig.supxlabel("Time [s]") | ||
|
||
unit = 'rad' | ||
plt.figure(0) | ||
plt.plot(time[0], error_angle_rad, marker=".", c="red") | ||
plt.title("Error angle \n" + "Error average:" + format(error_average, '+.2e') + unit + "\n Standard deviation:" + format(standard_deviation, '+.2e') + unit) | ||
plt.xlabel("Time [s]") | ||
plt.ylabel("Angle [rad]") | ||
|
||
# Data save | ||
if args.no_gui: | ||
plt.savefig(read_file_tag + "_attitude_observer.png") # save last figure only | ||
else: | ||
plt.show() |
Oops, something went wrong.