From 05eb6c3e1440a1396aee794e883e1b11d84b29d5 Mon Sep 17 00:00:00 2001 From: Aaron Trowbridge Date: Tue, 18 Jul 2023 19:44:40 -0400 Subject: [PATCH 1/3] edits --- src/utils.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.jl b/src/utils.jl index 1e57c03..907ec16 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -22,7 +22,7 @@ end function derivative(X::AbstractMatrix, Δt::AbstractVecOrMat) if Δt isa AbstractMatrix - @assert size(X, 1) == 1 "X must be a row vector if Δt is a matrix" + @assert size(Δt, 1) == 1 "X must be a row vector if Δt is a matrix" Δt = Δt[1, :] end @assert size(X, 2) == length(Δt) "number of columns of X ($(size(X, 2))) must equal length of Δt ($(length(Δt))" From 7252c9ceaab7dc2ae8d2649f449519eaba76cf6f Mon Sep 17 00:00:00 2001 From: Aaron Trowbridge Date: Thu, 20 Jul 2023 14:18:31 -0400 Subject: [PATCH 2/3] edits --- examples/notebooks/test.ipynb | 54 ++++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 10 deletions(-) diff --git a/examples/notebooks/test.ipynb b/examples/notebooks/test.ipynb index a7ad2d8..947222f 100644 --- a/examples/notebooks/test.ipynb +++ b/examples/notebooks/test.ipynb @@ -18,7 +18,7 @@ { "data": { "text/plain": [ - "(x = [0.7998212595615319 0.9744983202425099 … 0.7888318461990351 0.9320818211239843; 0.9938059299845051 0.3758690775924203 … 0.7272204862554783 0.019360605883686044; 0.6770512305599024 0.11689707956150108 … 0.7572171303709458 0.7365418569407084], u = [0.49104677753805104 0.6869440397391979 … 0.13075183905028276 0.16904002092470605; 0.010346792905140068 0.9270789507817083 … 0.3190135721682281 0.677912284560348], Δt = [0.1, 0.1, 0.1, 0.1, 0.1])" + "(x = [0.2558521006161333 0.3643229557301567 … 0.028421990683857645 0.674449213638827; 0.6775126057311323 0.8693932559506807 … 0.6346904291240297 0.3467504362453314; 0.036821340524149204 0.8860756494349437 … 0.6816687908075938 0.6110015729545025], u = [0.7659639533403911 0.4632868932905665 … 0.9939025648817892 0.2105062998955718; 0.9782389824455723 0.6114492277497968 … 0.9632269069591805 0.09168624247176993], Δt = [0.1, 0.1, 0.1, 0.1, 0.1])" ] }, "metadata": {}, @@ -41,7 +41,7 @@ { "data": { "text/plain": [ - "NamedTrajectory{Float64}([0.7998212595615319 0.9744983202425099 … 0.7888318461990351 0.9320818211239843; 0.9938059299845051 0.3758690775924203 … 0.7272204862554783 0.019360605883686044; … ; 0.010346792905140068 0.9270789507817083 … 0.3190135721682281 0.677912284560348; 0.1 0.1 … 0.1 0.1], [0.7998212595615319, 0.9938059299845051, 0.6770512305599024, 0.49104677753805104, 0.010346792905140068, 0.1, 0.9744983202425099, 0.3758690775924203, 0.11689707956150108, 0.6869440397391979 … 0.7572171303709458, 0.13075183905028276, 0.3190135721682281, 0.1, 0.9320818211239843, 0.019360605883686044, 0.7365418569407084, 0.16904002092470605, 0.677912284560348, 0.1], 5, :Δt, 6, (x = 3, u = 2, Δt = 1, states = 3, controls = 3), NamedTuple(), NamedTuple(), NamedTuple(), NamedTuple(), (x = 1:3, u = 4:5, Δt = 6:6, states = [1, 2, 3], controls = [4, 5, 6]), (:x, :u, :Δt), (:x,), (:u, :Δt))" + "NamedTrajectory{Float64}([0.2558521006161333 0.3643229557301567 … 0.028421990683857645 0.674449213638827; 0.6775126057311323 0.8693932559506807 … 0.6346904291240297 0.3467504362453314; … ; 0.9782389824455723 0.6114492277497968 … 0.9632269069591805 0.09168624247176993; 0.1 0.1 … 0.1 0.1], [0.2558521006161333, 0.6775126057311323, 0.036821340524149204, 0.7659639533403911, 0.9782389824455723, 0.1, 0.3643229557301567, 0.8693932559506807, 0.8860756494349437, 0.4632868932905665 … 0.6816687908075938, 0.9939025648817892, 0.9632269069591805, 0.1, 0.674449213638827, 0.3467504362453314, 0.6110015729545025, 0.2105062998955718, 0.09168624247176993, 0.1], 5, :Δt, 6, (x = 3, u = 2, Δt = 1, states = 3, controls = 3), NamedTuple(), NamedTuple(), NamedTuple(), NamedTuple(), (x = 1:3, u = 4:5, Δt = 6:6, states = [1, 2, 3], controls = [4, 5, 6]), (:x, :u, :Δt), (:x,), (:u, :Δt))" ] }, "metadata": {}, @@ -49,7 +49,27 @@ } ], "source": [ - "traj = NamedTrajectory(data; timestep=:Δt, controls=(:u, :Δt))" + "traj = NamedTrajectory(data; timestep=:Δt, controls=(:u, :Δt))\n", + "traj2 = NamedTrajectory(data; timestep=:Δt, controls=(:u, :Δt))" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "true" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "traj.components == traj2.components" ] }, { @@ -60,12 +80,26 @@ { "data": { "text/plain": [ - "5-element Vector{Float64}:\n", - " 0.0\n", - " 0.1\n", - " 0.2\n", - " 0.30000000000000004\n", - " 0.4" + "true" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "components(traj) == components(traj2)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "true" ] }, "metadata": {}, @@ -73,7 +107,7 @@ } ], "source": [ - "times(traj)" + "isequal(traj, traj2)" ] }, { From 8ff6ef2d6b5c2b05bed90c6be4ddbb9d40459e7a Mon Sep 17 00:00:00 2001 From: Aaron Trowbridge Date: Sun, 23 Jul 2023 17:57:48 -0400 Subject: [PATCH 3/3] edits --- .github/workflows/CI.yml | 2 +- src/plotting.jl | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a4b0358..427063b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -19,12 +19,12 @@ jobs: matrix: version: - '1.8' + - '1.9' - 'nightly' os: - ubuntu-latest arch: - x64 - - x86 steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v1 diff --git a/src/plotting.jl b/src/plotting.jl index 334ec6d..f8464c4 100644 --- a/src/plotting.jl +++ b/src/plotting.jl @@ -5,6 +5,8 @@ export plot using CairoMakie using LaTeXStrings +import CairoMakie: plot + using ..StructNamedTrajectory using ..StructKnotPoint using ..MethodsNamedTrajectory