Skip to content

Latest commit

 

History

History
138 lines (108 loc) · 5.35 KB

File metadata and controls

138 lines (108 loc) · 5.35 KB

Reproduce Figures from journal paper (extending ICRA 21)

Backprojection

python -m nn_closed_loop.example_backward \
	--partitioner None \
	--propagator CROWN \
	--system double_integrator \
	--state_feedback \
	--show_plot \
	--boundaries polytope \
	--num_partitions "[10, 10]" \
	--plot_lims "[[1.75,3.25],[-0.3,1.25]]"

You can change --num_partitions to get the various fidelities.

2x2 4x4 8x8 16x16
2x2 4x4 8x8 16x16

3D Quadrotor Plot

Within example.py, we set inputs_to_highlight to have 3 components by default for the quadrotor system, which tells the plotting scripts to make a 3D plot (rather than the 2D plots for the double integrator):

python -m nn_closed_loop.example \
	--partitioner None \
	--propagator CROWN \
	--system quadrotor \
	--state_feedback \
	--t_max 1.2 \
	--save_plot --show_plot \
	--boundaries lp \
	--plot_aspect equal

Note that this doesn't affect the reachable set calculations (all dimensions' rechability is computed), just the visualization.

You can change --num_partitions to get the various fidelities.

State Feedback Output Feedback
2x2 4x4

If you want to get an animated 3D plot, add the --make_animation flag:

animation

Partitioner Comparison

You can change the --partitioner flag to get various reachable set estimates:

python -m nn_closed_loop.example \
	--partitioner GreedySimGuided \
	--propagator CROWN \
	--system double_integrator \
	--state_feedback \
	--t_max 5 \
	--skip_show_plot \
	--make_animation

You can change which timestep GSG optimizes for by going into ClosedLoopGreedySimGuidedPartitioner.py method grab_from_M and changing the commented value (sorry for the major hack).

UnGuided SimGuided GreedySimGuided-0 GreedySimGuided-4
UnGuided SimGuided GreedySimGuided-0 GreedySimGuided-4

Compare Reach-LP and Reach-SDP

In nn_closed_loop/experiments.py, at the bottom check that these are uncommented:

# Like Fig 3 in ICRA21 paper
c = CompareRuntimeVsErrorTable()
c.run()
c.plot()  # 3A: table
c.plot_reachable_sets()  # 3B: overlay reachable sets
c.plot_error_vs_timestep()  # 3C: error vs timestep

Running python -m nn_closed_loop.experiments will generate:

  • a .pkl file in nn_closed_loop/results/logs, which will then be loaded to generate...
  • this table output (and the latex version of the table)
Algorithm                     Runtime [s]            Error
----------------------------  -------------------  -------
Reach-SDP~\cite{hu2020reach}  $42.571 \pm 0.538$       207
Reach-SDP-Partition           $670.257 \pm 2.913$       12
Reach-LP                      $0.017 \pm 0.000$       1590
Reach-LP-Partition            $0.263 \pm 0.001$         34
  • and the following two plots in the same directory as the .pkl file:
Reachable Sets Error per Timestep
reachable SimGuided

Compare Linear Program and Closed-Form solution timings

In nn_closed_loop/experiments.py, at the bottom check that these are uncommented:

c = CompareLPvsCF(system="double_integrator")
c.run()
c.plot()

Running python -m nn_closed_loop.experiments will generate:

  • a .pkl file in nn_closed_loop/results/logs, which will then be loaded to generate...
  • this table output (and the latex version of the table)
      1                  4                  16
----  -----------------  -----------------  -----------------
L.P.  $0.229 \pm 0.018$  $0.856 \pm 0.046$  $3.308 \pm 0.091$
C.F.  $0.017 \pm 0.000$  $0.066 \pm 0.000$  $0.265 \pm 0.002$

You can change system="quadrotor" to see the corresponding table for the 6D quadrotor system.

Other Systems

Duffing

python -m nn_closed_loop.example --partitioner None --propagator CROWN --system duffing --state_feedback --t_max 0.3

will output this plot: duffing

ISS

python -m nn_closed_loop.example --partitioner None --propagator CROWN --system iss --state_feedback --t_max 0.21

will output this plot: iss