Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
255 commits
Select commit Hold shift + click to select a range
81ac1dd
Removing unnecessary comment
Federico-PizarroBejarano Jul 26, 2022
1179991
Merge branch 'main' into dev-experiment-class
Federico-PizarroBejarano Jul 28, 2022
49e4e24
Updating the experiment class and related files
Federico-PizarroBejarano Jul 28, 2022
280e50e
changing pid to work with the experiment class
Federico-PizarroBejarano Jul 28, 2022
bb2786b
Cleaning up verbose API tests and documentation
Federico-PizarroBejarano Jul 28, 2022
82a18d5
Added 3D quad symbolic model, made the 3D quad observation the body r…
adamhall Aug 1, 2022
4656c5d
Fixing justin's comments
Federico-PizarroBejarano Aug 2, 2022
fbd2aef
Commented out 0-ing of the default damping
JacopoPan Aug 2, 2022
168641a
Typos and comments in quadrotor 3D model.
JacopoPan Aug 2, 2022
9911504
Merge pull request #58 from adamhall/dev-3d-quad-symoblic
JacopoPan Aug 2, 2022
c031b74
Removed empty line
JacopoPan Aug 2, 2022
6172ba9
Merge branch 'main' into dev-experiment-class
Federico-PizarroBejarano Aug 3, 2022
e31d4ea
Merge branch 'dev-experiment-class' into changing_normalization_in_env
Federico-PizarroBejarano Aug 3, 2022
5b0dd44
Merge pull request #56 from Federico-PizarroBejarano/updating_experiment
Federico-PizarroBejarano Aug 3, 2022
3588489
Changing physical action space to bounds
Federico-PizarroBejarano Aug 3, 2022
05db47c
Merge pull request #53 from Federico-PizarroBejarano/changing_normali…
Federico-PizarroBejarano Aug 3, 2022
dab7a32
Fixing naming of actions
Federico-PizarroBejarano Aug 3, 2022
10cfe56
Merge branch 'dev-experiment-class' into experimenting_with_pid
Federico-PizarroBejarano Aug 3, 2022
9c55c48
Adding some basic documentation of the different action types
Federico-PizarroBejarano Aug 3, 2022
290aa8c
Adding data logging to PID experiment
Federico-PizarroBejarano Aug 3, 2022
b54da16
Creating temp-data folder if it does not exist
Federico-PizarroBejarano Aug 3, 2022
81c8090
Merge pull request #60 from Federico-PizarroBejarano/experimenting_wi…
Federico-PizarroBejarano Aug 3, 2022
fca734d
Update base_aviary.py
JacopoPan Aug 11, 2022
593b805
Adding timestamp
Federico-PizarroBejarano Aug 11, 2022
e88bb97
Fixing error in quadrotor 3D stabilization
Federico-PizarroBejarano Aug 11, 2022
4a3098e
A few more errors
Federico-PizarroBejarano Aug 11, 2022
35961a6
Updating README with PID
Federico-PizarroBejarano Aug 11, 2022
fd91f9d
Raising an error if the passed action is not 1D
Federico-PizarroBejarano Aug 12, 2022
cfb42ab
Calling super().__init__ in MPC
Federico-PizarroBejarano Aug 12, 2022
f5a101d
Error in verbose api inertial prop
Federico-PizarroBejarano Aug 12, 2022
9c6b9dd
Updating 3D quad and examples
Federico-PizarroBejarano Aug 12, 2022
7e5874e
Merge pull request #63 from Federico-PizarroBejarano/fixing_typos
JacopoPan Aug 12, 2022
4209420
Merge pull request #64 from Federico-PizarroBejarano/updating_examples
JacopoPan Aug 12, 2022
99d1ca7
Updating all controllers
Federico-PizarroBejarano Aug 12, 2022
c5fdfcf
Fixing some errors in iLQR
Federico-PizarroBejarano Aug 12, 2022
dcba0ee
Cleaning up LQR utils since most functions are unused
Federico-PizarroBejarano Aug 12, 2022
f06e206
Removing safety filter stuff
Federico-PizarroBejarano Aug 12, 2022
6fb56cb
Adding LQR experiments and tests
Federico-PizarroBejarano Aug 12, 2022
fb59046
Fixing step error
Federico-PizarroBejarano Aug 12, 2022
e4f3c8a
Cleaning up iLQR some more and fixing typo in reset_before_run
Federico-PizarroBejarano Aug 12, 2022
7a37cc8
Fixing iLQR training to be static during each train/execute pair
Federico-PizarroBejarano Aug 13, 2022
c0b8be6
Fixing testing issue with LQR
Federico-PizarroBejarano Aug 13, 2022
9c92fa0
Fixing printing metrics
Federico-PizarroBejarano Aug 13, 2022
808f2f4
Adding independent config files for each task and system
Federico-PizarroBejarano Aug 15, 2022
579222c
Linting and fixing small bug
Federico-PizarroBejarano Aug 15, 2022
ef2ccb6
Added original plotting to experiment
Federico-PizarroBejarano Aug 15, 2022
2359429
Linting new files
Federico-PizarroBejarano Aug 15, 2022
5a5f7a7
Final iLQR fix
Federico-PizarroBejarano Aug 15, 2022
ac4d722
Fixing out_of_bounds issue
Federico-PizarroBejarano Aug 15, 2022
cab55e9
Quick documentation fix
Federico-PizarroBejarano Aug 15, 2022
5bb71cc
Linting examples and experiments
Federico-PizarroBejarano Aug 15, 2022
9a30617
Removing functional changes
Federico-PizarroBejarano Aug 15, 2022
f67ee05
Fixing quad trajectories so that they don't go out of bounds
Federico-PizarroBejarano Aug 15, 2022
9507dfb
Testing iLQR training as well as execution
Federico-PizarroBejarano Aug 15, 2022
3e5cee4
Add metrics module and MMD metric implementation.
Justin-Yuan Aug 16, 2022
5ab02d5
Rename metrics module to avoid name conflict and to pass test
Justin-Yuan Aug 16, 2022
d98e578
Adding basic MPSC and safety filter files
Federico-PizarroBejarano Aug 16, 2022
e7b1d04
Further linting and standardizing save and load in linear_mpsc
Federico-PizarroBejarano Aug 16, 2022
2cbef0d
Fixing typo in documentation
Federico-PizarroBejarano Aug 16, 2022
b5289a2
Merge branch 'linting' into adding_safety_filters
Federico-PizarroBejarano Aug 16, 2022
61a90e7
Merge branch updating_controllers into adding_safety_filters
Federico-PizarroBejarano Aug 16, 2022
648b479
Fixing some issues to allow the figure8 test to run
Federico-PizarroBejarano Aug 16, 2022
52943df
Rearranged metric files.
Justin-Yuan Aug 16, 2022
744c166
Making safety filters work with the experiment class
Federico-PizarroBejarano Aug 16, 2022
a4f3a3e
Removing training from test since it cannot locate MOSEK license
Federico-PizarroBejarano Aug 16, 2022
0601caa
Linting more files and fixing all documentation
Federico-PizarroBejarano Aug 16, 2022
b4b10aa
More linting
Federico-PizarroBejarano Aug 16, 2022
b4fb085
Linting the examples and fixing documentation
Federico-PizarroBejarano Aug 16, 2022
581aa49
Merge pull request #69 from Justin-Yuan/dev-experiment-class
Justin-Yuan Aug 16, 2022
486c4ae
Fixing some small issues
Federico-PizarroBejarano Aug 16, 2022
f8052dd
Making certain things abstract
Federico-PizarroBejarano Aug 16, 2022
2bf81b8
Merge branch 'dev-experiment-class' into linting
Federico-PizarroBejarano Aug 17, 2022
0b171a1
Cleaning up new file and final changes to cartpole and quadrotor
Federico-PizarroBejarano Aug 17, 2022
b02a7b6
Merge pull request #68 from Federico-PizarroBejarano/linting
Federico-PizarroBejarano Aug 17, 2022
45dd424
Merge branch 'dev-experiment-class' into updating_controllers
Federico-PizarroBejarano Aug 17, 2022
9ec46cf
Linting files
Federico-PizarroBejarano Aug 17, 2022
c154782
Fixing typo
Federico-PizarroBejarano Aug 17, 2022
7fe3c08
Adding 3D quad to lqr tests
Federico-PizarroBejarano Aug 17, 2022
3f36648
Merge branch 'updating_controllers' into adding_safety_filters
Federico-PizarroBejarano Aug 17, 2022
22668b7
Cleaning up previous merge and some documentation
Federico-PizarroBejarano Aug 17, 2022
6a552eb
Add similarity metrics: MSE(ED), DTW, LCSS, EDR, FD
Justin-Yuan Aug 17, 2022
e6f24a4
Adding initial CBF code, although cbf_nn still does not work
Federico-PizarroBejarano Aug 18, 2022
1961fe9
Improving MPSC testing and safety filter generality
Federico-PizarroBejarano Aug 18, 2022
879223f
Fixing test error
Federico-PizarroBejarano Aug 18, 2022
8af50aa
Merge branch 'adding_safety_filters' into add_updated_cbf
Federico-PizarroBejarano Aug 18, 2022
283a830
Improving model saving
Federico-PizarroBejarano Aug 18, 2022
23a899e
Actually fixed model folder
Federico-PizarroBejarano Aug 18, 2022
7bb7e5a
Fixing tests
Federico-PizarroBejarano Aug 18, 2022
cb59884
Cleaning up implementation and documentation
Federico-PizarroBejarano Aug 18, 2022
a831e37
Making cbf and cbf_nn more consistent
Federico-PizarroBejarano Aug 18, 2022
156af61
Fixing typo and some documentation
Federico-PizarroBejarano Aug 18, 2022
4d5606f
Cleaning up MPSC test and removing safety filter from base controller
Federico-PizarroBejarano Aug 18, 2022
d208586
Adding tests for the MPSC specifically, not just figure 8
Federico-PizarroBejarano Aug 18, 2022
ce4fdf5
Merge branch 'adding_safety_filters' into mpsc_tests
Federico-PizarroBejarano Aug 19, 2022
50566cb
Fixing issue in safe_ppo
Federico-PizarroBejarano Aug 19, 2022
caa86b3
Merge pull request #66 from Federico-PizarroBejarano/updating_control…
Federico-PizarroBejarano Aug 22, 2022
f4a0a1f
Removing linting changes
Federico-PizarroBejarano Aug 22, 2022
d15ecbc
Merge with upstream PR#66
Justin-Yuan Aug 22, 2022
142a145
Linting some docstrings
Federico-PizarroBejarano Aug 22, 2022
ace4f7a
Add custom state-pair distance metric to trajectory similarity metric…
Justin-Yuan Aug 23, 2022
0b0cb54
.
Justin-Yuan Aug 25, 2022
4971fbb
Add script to test all current traj similarity metrics with Experimen…
Justin-Yuan Aug 25, 2022
3e62f84
Add LSED metric as a base case
Justin-Yuan Aug 25, 2022
2dd7d19
Merge pull request #71 from Justin-Yuan/dev-experiment-class
Justin-Yuan Aug 27, 2022
a28aa32
Initialize branch to add prior feature to ctrl
Justin-Yuan Aug 27, 2022
5a9f576
Merge pull request #75 from Federico-PizarroBejarano/linting
JacopoPan Aug 27, 2022
f1845cc
Add quadrotor env args to customize prior and setup_prior method to B…
Justin-Yuan Aug 29, 2022
d323139
Merge pull request #74 from Federico-PizarroBejarano/adding_safety_fi…
Federico-PizarroBejarano Aug 29, 2022
dfc9905
Merge pull request #80 from Federico-PizarroBejarano/mpsc_tests
Federico-PizarroBejarano Aug 29, 2022
fc0efb9
Cleaning up CBF implementation in accordance with Lukas's comments
Federico-PizarroBejarano Aug 30, 2022
100be9c
Small fix to MPSC tests to be more correct
Federico-PizarroBejarano Aug 30, 2022
d7cccc3
Fix prior customization for controllers
Justin-Yuan Aug 31, 2022
772a5ee
Add prior prop randomization in BaseController
Justin-Yuan Aug 31, 2022
1de58e0
Fix prior in envs, remove unused prior variables. Now logging the bas…
Justin-Yuan Aug 31, 2022
de44051
Fix PID with new prior format, and fix pid experiment config files
Justin-Yuan Sep 1, 2022
ac8f372
First commit.
adamhall Sep 1, 2022
de57a8d
Handling the case where there are only input constraitns and not stat…
adamhall Sep 2, 2022
6c45ccd
Use separate pid.yaml to specify prior config in pid experiment
Justin-Yuan Sep 2, 2022
d87d834
Add docstring to _setup_symbolic() for envs
Justin-Yuan Sep 2, 2022
15cba9c
Remove commented line on getting gravity term
Justin-Yuan Sep 2, 2022
0e3a782
Change logged physical parameters in env._get_reset_info() as the tru…
Justin-Yuan Sep 2, 2022
888571d
Move getting prior to reset() in PID
Justin-Yuan Sep 2, 2022
0d92605
Fix bug in BaseController.get_prior()
Justin-Yuan Sep 2, 2022
c451fb2
Merge pull request #77 from utiasDSL/dev-scramble-prior
Justin-Yuan Sep 2, 2022
c5afd63
Added rounding to get_value and the decimals attribute.
adamhall Sep 3, 2022
3dcc154
Added some comments and assertions as per issue #62.
adamhall Sep 3, 2022
efade77
Prior information wasn't updated U_EQ properly.
adamhall Sep 6, 2022
0138abb
Updated MPC with prior_prop parameter. Tested to make sure its workin…
adamhall Sep 6, 2022
a38d21b
Updated Linear MPC with prior_prop parameter. Tested to make sure its…
adamhall Sep 6, 2022
0de1cf3
Improving explicit typing and documentation
Federico-PizarroBejarano Sep 6, 2022
5b895fa
Delete TODOs
Federico-PizarroBejarano Sep 6, 2022
37485f6
Changed prior_prop to prior_info
adamhall Sep 6, 2022
5cc5ba0
Adding priors to MPSC
Federico-PizarroBejarano Sep 6, 2022
42169c6
Update GPMPC and experiment yamls. Checked and all seem to run reason…
adamhall Sep 7, 2022
815409c
added prior_info docstring
adamhall Sep 7, 2022
20ec4e9
Updated to be compatible with new prior setup.
adamhall Sep 7, 2022
43971cb
Updated to use model.U_EQ, otherwise we are using knowledge about the…
adamhall Sep 7, 2022
8b52cc1
Updated to use new prior model setup.
adamhall Sep 7, 2022
47fa30f
Updated to not use env.U_GOAL which uses prior knowledge about the tr…
adamhall Sep 7, 2022
4ab742b
Fixed env.model references.
adamhall Sep 7, 2022
b5bcf61
Merge pull request #81 from Federico-PizarroBejarano/add_updated_cbf
Federico-PizarroBejarano Sep 7, 2022
8599a75
Merge branch 'dev-experiment-class' into sf_priors
Federico-PizarroBejarano Sep 7, 2022
9a2770e
Adding prior code to CBFs
Federico-PizarroBejarano Sep 7, 2022
2544524
Fixing some minor typos
Federico-PizarroBejarano Sep 7, 2022
cd646e9
Merge pull request #92 from Federico-PizarroBejarano/sf_priors
Federico-PizarroBejarano Sep 9, 2022
1ac52a8
Merge pull request #88 from adamhall/dev-experiment-class-constraints
adamhall Sep 12, 2022
0463271
Merge pull request #94 from utiasDSL/dev-experiment-class-constraints
adamhall Sep 12, 2022
4af3d78
Add files via upload
JacopoPan Sep 20, 2022
def0e3b
Update README.md
JacopoPan Sep 20, 2022
c5a8721
Add files via upload
JacopoPan Sep 20, 2022
9285c65
Updated to that most controllers use the BaseController kwargs for pr…
adamhall Sep 26, 2022
418b5ca
Changed env symbolic references to self.model.U_EQ
adamhall Sep 27, 2022
bfe74b3
Merge pull request #90 from adamhall/dev-experiment-class-mpc
adamhall Sep 28, 2022
b102431
Added all epoch changes to fresh pull of dev experiment class
adamhall Oct 18, 2022
3ca44ad
Replaced ctrl.select_action with self._select_action and modified _se…
adamhall Oct 20, 2022
43f3c56
Added empty line between functions
adamhall Oct 20, 2022
f416bde
Added doc strings
adamhall Oct 20, 2022
9fbf26c
Fixing LQR stabilization
Federico-PizarroBejarano Dec 7, 2022
16fc3a2
Fixing equilibrium
Federico-PizarroBejarano Dec 9, 2022
ec7cdd6
Updating iLQR as well
Federico-PizarroBejarano Dec 9, 2022
b13ef0d
Removing recalculation of gain since it makes no difference somehow
Federico-PizarroBejarano Dec 9, 2022
d2fa737
Merge pull request #113 from utiasDSL/dev-experiment-class-epochs
adamhall Dec 13, 2022
0219fb0
Merge branch 'dev-experiment-class' into x_goal_bug
Federico-PizarroBejarano Dec 13, 2022
b0fec21
Added one to counter as its not indexed until after this function is …
adamhall Dec 14, 2022
ae51d61
Merge pull request #118 from Federico-PizarroBejarano/x_goal_bug
Federico-PizarroBejarano Dec 14, 2022
05b2817
Incremented counters
adamhall Dec 19, 2022
3097088
Small fixes from smooth-mpsc-paper branch
Federico-PizarroBejarano Jan 31, 2023
b55e85e
Adding changes from the pid_comparison branch
Federico-PizarroBejarano Jan 31, 2023
a0aa791
Adding changes from crazyflie_mpsc branch
Federico-PizarroBejarano Jan 31, 2023
c03a290
reverting iLQR to previous version to make branch cleaner
Federico-PizarroBejarano Jan 31, 2023
d71e61b
Added CTRL_TIMESTEP to where it is used in the actual trajectory gene…
adamhall Feb 22, 2023
d7d8c7a
Added self.CTRL_TIMESTEP to increment the trajectory by 1 where the t…
adamhall Feb 22, 2023
983e803
added at_reset variable for determining how much the ctrl_step_counte…
adamhall Feb 22, 2023
1e207b3
Updated cartpole as per PR #119. Note that _get_info() does have the …
adamhall Feb 22, 2023
accba4a
Fixed small issues, re-added main.py with different name
Federico-PizarroBejarano Mar 21, 2023
f830e7c
Fixed gym import error
Federico-PizarroBejarano Mar 22, 2023
2142bd5
Moved trajectory length increase to benchmark_env and changed the res…
adamhall Mar 28, 2023
0880a18
Fixed bug where 0.0 was added to metrics data as default value instea…
adamhall Apr 3, 2023
5ad8495
Updated gym version installation version.
adamhall Apr 3, 2023
0a2ea4b
Added verbose option, and statement to tell use that key is not in in…
adamhall Apr 3, 2023
89bf30f
Fixed typos.
adamhall Apr 3, 2023
65ec24a
Merge pull request #119 from adamhall/mse-bug
adamhall Apr 5, 2023
0c7f6d0
Merging in Adam's changes
Federico-PizarroBejarano Apr 5, 2023
74a2e73
Merge pull request #122 from Federico-PizarroBejarano/dev-experiment-…
Federico-PizarroBejarano Apr 5, 2023
96a10aa
Moving compute_metrics to MetricExtractor
Federico-PizarroBejarano Apr 5, 2023
d5e5daa
Merge pull request #126 from Federico-PizarroBejarano/static_metric_e…
Federico-PizarroBejarano Apr 13, 2023
002fb13
Update README.md
JacopoPan Apr 20, 2023
65b207c
Deleting Epoch, similarity, and past experiments
Federico-PizarroBejarano Apr 25, 2023
01f5673
Cleaning up experiments
Federico-PizarroBejarano Apr 26, 2023
c33a3df
Deleting examples and making the experiments folder the examples folder
Federico-PizarroBejarano Apr 26, 2023
133d107
Moving execute_rl_controller.py to experiments folder
Federico-PizarroBejarano Apr 27, 2023
510fb6f
Cleaned up tutorial
Federico-PizarroBejarano Apr 27, 2023
83daa6a
Adding basic RL example
Federico-PizarroBejarano Apr 28, 2023
26ced11
PID minor bugfix and updated README
JacopoPan Apr 28, 2023
a54e2b4
A bit more cleaning and editing
Federico-PizarroBejarano Apr 28, 2023
6c02e35
Gym to gymnasium test
JacopoPan Apr 28, 2023
b95f6b0
Linting examples
Federico-PizarroBejarano Apr 28, 2023
35ceba8
Linting safety filters
Federico-PizarroBejarano Apr 28, 2023
64eeeb4
Linting utils
Federico-PizarroBejarano Apr 28, 2023
be207ba
Linting envs
Federico-PizarroBejarano Apr 28, 2023
a3c0016
Linting math and models
Federico-PizarroBejarano Apr 28, 2023
944c9d3
Linting controllers and experiments
Federico-PizarroBejarano Apr 28, 2023
68b0e9a
Merge branch 'main-redux' into main-redux-2
Federico-PizarroBejarano Apr 28, 2023
201d9bf
Some final changes
Federico-PizarroBejarano May 8, 2023
cb01519
Merge pull request #130 from Federico-PizarroBejarano/main-redux-2
JacopoPan May 8, 2023
3dd1fd8
Updating to Python 3.10
Federico-PizarroBejarano May 8, 2023
6e10867
Update setup.py
Federico-PizarroBejarano May 9, 2023
571a71f
Minor linting
Federico-PizarroBejarano May 9, 2023
0a5b722
Update README.md
JacopoPan May 16, 2023
187e708
Updating examples and README
Federico-PizarroBejarano May 16, 2023
7bd2f3a
Lowering randomness in PID example as trajectory tracking was failing
Federico-PizarroBejarano May 16, 2023
996e1f5
Merge pull request #131 from Federico-PizarroBejarano/main
Federico-PizarroBejarano May 17, 2023
4656106
Removing comments because they look ugly on github and are redundant
Federico-PizarroBejarano May 17, 2023
ec4171f
Merge pull request #132 from Federico-PizarroBejarano/main
Federico-PizarroBejarano May 17, 2023
6fca847
Adding pre-commit hooks and linting all files
Federico-PizarroBejarano May 18, 2023
2cf71c3
Addint pre-commit hooks as additional github action
Federico-PizarroBejarano May 18, 2023
ef5b0fd
Renaming actions to be more explanatory
Federico-PizarroBejarano May 18, 2023
b800476
Fixing versioning and adding documentation
Federico-PizarroBejarano May 18, 2023
8631e7f
Adding pre-commit as step in run tests
Federico-PizarroBejarano May 18, 2023
e1b7815
Update pyproject.toml to point to main
Federico-PizarroBejarano Jun 6, 2023
ad7a20f
Adding slurm script
Jun 13, 2023
140ed17
Cleaning up error
Jun 13, 2023
39659bf
Updating linter and rerunning
Federico-PizarroBejarano Oct 4, 2023
a9f2084
Adding various minor updates
Federico-PizarroBejarano Oct 4, 2023
7266c26
Changed instances of randint to integers as per issue #137
adamhall Oct 4, 2023
5f078bf
Retraining all of the RL models
Oct 4, 2023
83a4b14
Adding and removing dependencies
Oct 5, 2023
74e9056
Merge pull request #140 from Federico-PizarroBejarano/fixing_dependen…
JacopoPan Oct 12, 2023
d286cea
Merge pull request #138 from adamhall/main
Federico-PizarroBejarano Oct 12, 2023
9b90f5f
Increased line length for isort
Federico-PizarroBejarano Oct 12, 2023
d124254
Merge remote-tracking branch 'upstream/main' into improved_linting
Federico-PizarroBejarano Oct 12, 2023
c5f27c8
Merge branch 'main' into improved_linting
Federico-PizarroBejarano Oct 12, 2023
0b118b4
Merge pull request #133 from Federico-PizarroBejarano/improved_linting
adamhall Oct 12, 2023
560b1a3
Merge branch 'improved_linting' into minor_updates
Federico-PizarroBejarano Oct 12, 2023
83fae93
Merge pull request #139 from Federico-PizarroBejarano/minor_updates
adamhall Oct 12, 2023
8c51bd4
Starter files and KITTI data downloader
andresc44 Mar 24, 2024
8d4e4d5
first commit for RANSAC branch
andresc44 Mar 24, 2024
2aa2fce
Install cv version to run SIFT
andresc44 Mar 25, 2024
f904141
modified gitignore
andresc44 Mar 25, 2024
6351771
Add skeleton for RANSAC in stereo_vo_base.py
andresc44 Mar 26, 2024
ab09125
RANSAC algorithm implemented without T matrix computation
andresc44 Mar 26, 2024
bafd8d2
Merge branch 'main' into lab4-andres
JustMohsen Mar 30, 2024
d710fd8
move lab4 to folder
JustMohsen Mar 30, 2024
2ea5307
Merge branch 'main' into lab4-andres
JustMohsen Mar 30, 2024
289ffc9
update poetry
JustMohsen Mar 30, 2024
28ac7e1
Update poetry.lock
JustMohsen Mar 30, 2024
6204e70
MOVE LAB4 to its own folder
JustMohsen Mar 31, 2024
9e1db6b
update poetry
JustMohsen Mar 31, 2024
774a6d7
move lab4 materials
JustMohsen Mar 31, 2024
c7527cd
update poetry
JustMohsen Mar 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
#### Temporary files
experiments/annual_reviews/figure6/trained_gp_model/bak_best_model_*.pth
experiments/annual_reviews/figure7/safe_exp_results/
experiments/annual_reviews/figure8/unsafe_ppo_model/bak_unsafe_ppo_model_30000.pt
experiments/annual_reviews/figure8/unsafe_ppo_temp_data/
examples/lqr/*data/
#
experiments/arxiv/cartpole_*/*data/
experiments/arxiv/quadrotor_*/*data/
examples/mpsc/temp-data/
examples/mpsc/unsafe_rl_temp_data/
#
examples/pid/*data/
#
results/
z_docstring.py
TODOs.md




# macOS users
.DS_Store

Expand Down Expand Up @@ -151,11 +149,10 @@ dmypy.json
.pyre/
.idea/
aer-course-project/lab3/image_folder/processed_frames/
aer-course-project/lab3/image_folder/input_frames/

aer-course-project/lab3/image_folder/
aer-course-project/edit_this_original.py

aer-course-project/PlanningAlgorithm/

# Local settings
.idea/
#lab4 CityData dir
CityData/
video.avi
58 changes: 58 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Install the pre-commit hooks below with
# 'pre-commit install'

# Auto-update the version of the hooks with
# 'pre-commit autoupdate'

# Run the hooks on all files with
# 'pre-commit run --all'

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-ast
- id: check-yaml
- id: check-toml
- id: check-added-large-files
args: ['--maxkb=10000']
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: check-merge-conflict
- id: debug-statements
- id: trailing-whitespace
- id: end-of-file-fixer
- id: double-quote-string-fixer

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort
args: ['--line-length=110']

- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v2.0.4
hooks:
- id: autopep8
name: autopep8-default
args: ['-i', '--ignore=C0301', '--max-line-length=1000']
exclude: (^tests/|^safe_control_gym/math_and_models/transformations.py)
- id: autopep8
name: autopep8-tests
args: ['-i', '--ignore=C0301,E501,E201,E241,E127', '--max-line-length=1000']
files: (^tests/|^safe_control_gym/math_and_models/transformations.py)

- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
name: flake8_default
args: ['--ignore=E501']
exclude: (^safe_control_gym/__init__.py|^tests/|^safe_control_gym/math_and_models/transformations.py)
- id: flake8
name: flake8_tests
args: ['--ignore=E501,E201,E241,E127']
files: (^tests/|^safe_control_gym/math_and_models/transformations.py)
exclude: ^tests/test_build.py
25 changes: 25 additions & 0 deletions aer-course-project/Lab4/downloadCityData.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import os
import zipfile
import gdown

_TARGET_DIR = os.path.expanduser('..') #Directory to store data
_FILE_ID= "1368NySV1bWwlOhp525TD0HJEvbCG0WZr" #Use Id for zip file on drive, ensure "Anyone with link can access"


def save_with_gdown(id, destination):
url = 'https://drive.google.com/uc?id='+id
gdown.download(url, destination, quiet=False)



if __name__ == '__main__':
zip_path = _TARGET_DIR + '/CityData.zip'
os.remove(zip_path) if os.path.exists(zip_path) else None
save_with_gdown(_FILE_ID, zip_path)
try:
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
zip_ref.extractall(_TARGET_DIR)
os.remove(zip_path)

except zipfile.BadZipFile:
print('Not a zip file or a corrupted zip file')
5 changes: 5 additions & 0 deletions aer-course-project/Lab4/downloader.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pip install gdown
pip install opencv-contrib-python
python3 downloadCityData.py
clear
echo "Finished extracting CityData folder"
Binary file added aer-course-project/Lab4/ground_truth_pose.mat
Binary file not shown.
153 changes: 153 additions & 0 deletions aer-course-project/Lab4/lab4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
"""
2021-02 -- Wenda Zhao, Miller Tang

This is the code base for a steoro visual odometry designed
for the course AER 1217H, Development of Autonomous UAS
https://carre.utoronto.ca/aer1217.
The Kitti dataset, raw_data/City/2011_09_26_drive_0005, is used in this assignment.
http://www.cvlibs.net/datasets/kitti/raw_data.php
"""

# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# Kitti Data cannot be saved on Github, too large (340 MB)
# run the following command to download data locally
# `./downloader.sh`
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

# ANDRES RANSAC BRANCH
# import pkg_resources
# pkg_resources.require("cv2==8.2.0")

import numpy as np
import cv2 as cv
import os
import scipy.io as sio
# from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt

from stereo_vo_base import StereoCamera, VisualOdometry


# pip install opencv-contrib-python

def main():
# current working directory
cwd = os.getcwd()

# the ground_truth_pose.mat is saved from the kitti 'raw_data_development_kit'->run_demoVehicelPath.m
# see http://www.cvlibs.net/datasets/kitti/raw_data.php for more details
OXTS_pose_gt = sio.loadmat('ground_truth_pose.mat')["pose"]

# image sequence
sequence_num = OXTS_pose_gt.shape[1]
pose_gt = np.zeros((sequence_num, 4, 4))
# save ground truth into pose_gt
for i in range(sequence_num):
pose_gt[i] = OXTS_pose_gt[0, i]

# ---------------------------- Parameter ---------------------------- #
path_0 = '/CityData/2011_09_26/2011_09_26_drive_0005_sync/image_00/data/'
path_1 = '/CityData/2011_09_26/2011_09_26_drive_0005_sync/image_01/data/'
zero_num = 10
# '/CityData/2011_09_26_calib/calib_cam_to_cam.txt'
# baseline, focalLength, fx, fy, cu, cv
cam = StereoCamera(0.537, 721.5377, 721.5377, 721.5377, 609.5593, 172.8540)
vo = VisualOdometry(cam)

# global transform to camera (starts as identity)
T = np.eye(4)
T_hist = np.zeros((sequence_num, 4, 4))
T_hist[0] = T

# convert to vehicel frame
# calibration results provided by kitti dataset in '/CityData/2011_09_26_calib/'
T_imu_to_velo = np.array([[9.999976e-01, 7.553071e-04, -2.035826e-03, -8.086759e-01],
[-7.854027e-04, 9.998898e-01, -1.482298e-02, 3.195559e-01],
[2.024406e-03, 1.482454e-02, 9.998881e-01, -7.997231e-01],
[0, 0, 0, 1]
])

T_velo_to_cam = np.array([[7.533745e-03, -9.999714e-01, -6.166020e-04, -4.069766e-03],
[1.480249e-02, 7.280733e-04, -9.998902e-01, -7.631618e-02],
[9.998621e-01, 7.523790e-03, 1.480755e-02, -2.717806e-01],
[0, 0, 0, 1]
])

T_cam_to_cam_center = np.array([[1.0, 0.0, 0.0, -0.537 / 2.0],
[0.0, 1.0, 0.0, 0.0],
[0.0, 0.0, 1.0, 0.0],
[0.0, 0.0, 0.0, 1.0]
])

T_imu_to_cam = T_velo_to_cam.dot(T_imu_to_velo)

T_imu_to_cam_center = T_cam_to_cam_center.dot(T_imu_to_cam)

T_cam_center_to_imu = np.linalg.inv(T_imu_to_cam_center)

# initialization offset: The ground truth data of the vehicle starts with (0, 0, 0) in GPS/IMU frame. But in the VO estimation, we set initial position of the stereo-camera's center as (0,0,0) using initial r. Therefore, we convert the ground truth data to camera center position in GPS frame with (0, 0, 0) as the initial position. The convertion is done by translation vector t_cv_v.

# translation from vehicle frame to camera center frame expressed in vehicle frame (from Kitti website)
t_cv_v = np.array([1.09, -0.32 - 0.537 / 2.0, 0.8])

cam_center_gt = np.zeros((sequence_num, 3))
for idx in range(sequence_num):
cam_center_gt[idx, :] = pose_gt[idx, 0:3, 3] + t_cv_v

# Transformation in vehicle frame
T_vehicle = np.zeros((sequence_num, 4, 4))

# record video
os.chdir(cwd)
fourcc = cv.VideoWriter_fourcc(*'MPEG')
video = cv.VideoWriter('./video.avi', fourcc, 5.0, (1242, 775)) # 375*2 + 25 (margin)

for img_id in range(sequence_num):
img_left = cv.imread(cwd + path_0 + str(img_id).zfill(zero_num) + '.png', 0)
img_right = cv.imread(cwd + path_1 + str(img_id).zfill(zero_num) + '.png', 0)

# finite-state machine
# update the C and r
frame_left, frame_right = vo.update(img_left, img_right, img_id)

# Create a white margin between two frames
margin = np.ones_like(frame_left) * 255
vertical_frame = np.concatenate((frame_left, margin[0:25], frame_right), axis=0)

# Update the transformation matrix
T_update = np.vstack(((np.concatenate((vo.C, (vo.r).reshape(-1, 1)), axis=1)),
np.array([[0, 0, 0, 1]])))
T = T_update.dot(T)
# Store the history of transformation matrix
T_hist[img_id] = T
# convert to vehicle frame
T_vehicle[img_id] = T_cam_center_to_imu.dot(np.linalg.inv(T_hist[img_id]))

cv.imshow('Visual Odometry', vertical_frame)
video.write(vertical_frame)
if cv.waitKey(10) & 0xFF == ord('q'):
break

print("VO ends\n")
video.release()
cv.destroyAllWindows()

# save the estimated transformation matrix
np.save('VO_T.npy', T_vehicle)

fig_traj = plt.figure(facecolor="white")
ax_t = fig_traj.add_subplot(111, projection='3d')
ax_t.plot(cam_center_gt[:, 0], cam_center_gt[:, 1], cam_center_gt[:, 2], color='red', label='ground truth trajectory', linewidth=1.9, alpha=0.9)
ax_t.plot(T_vehicle[:, 0, 3], T_vehicle[:, 1, 3], T_vehicle[:, 2, 3], color='steelblue', label='VO trajectory', linewidth=1.9, alpha=0.9)
ax_t.set_xlabel(r'X [m]')
ax_t.set_ylabel(r'Y [m]')
ax_t.set_zlabel(r'Z [m]')
ax_t.legend()
ax_t.set_zlim3d(-20.0, 25.0)
plt.title(r"Trajectory of the vehicle", fontsize=13, fontweight=0, color='black', style='italic', y=1.02)
plt.show()


if __name__ == '__main__':
print('We are using OpenCV version {}'.format(cv.__version__))
main()
Loading