Skip to content

Commit

Permalink
Fix missed deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
bjack205 committed Feb 28, 2022
1 parent b4f1c3d commit 53c1501
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ RobotDynamics.control_dim(::Cartpole) = 1

# Create the model
model = Cartpole()
n,m = size(model)
n,m = RD.dims(model)

# Generate random state and control vector
x,u = rand(model)
Expand Down
2 changes: 1 addition & 1 deletion docs/oldsrc/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ dynamics(model, z)
jacobian!(∇f, model, z)
```

We can also use `size(model)` to get `(n,m)`, `rand(model)` to get a tuple of randomly-sampled state and
We can also use `RD.dims(model)` to get `(n,m,n)`, `rand(model)` to get a tuple of randomly-sampled state and
control vectors, or `zeros(model)` to get 0-vectors of the state and control.

### Analytical Jacobians
Expand Down
2 changes: 1 addition & 1 deletion examples/cartpole.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ RobotDynamics.control_dim(::Cartpole) = 1

# Create the model
model = Cartpole()
n,m = size(model)
n,m = RD.dims(model)

# Generate random state and control vector
x,u = rand(model)
Expand Down
4 changes: 2 additions & 2 deletions test/cartpole_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ x0 = rand(model)[1]
@test RD.state_diff(model, x, x0) x - x0
@test RD.errstate_dim(model) == RD.state_dim(model)
G = zeros(n,n)
RD.state_diff_jacobian!(model, G, z)
RD.errstate_jacobian!(model, G, z)
@test G I(n)
G .= 0
RobotDynamics.state_diff_jacobian!(model, G, x)
RobotDynamics.errstate_jacobian!(model, G, x)
@test G I(n)
2 changes: 1 addition & 1 deletion test/discretized_dynamics_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include("double_integrator.jl")
## Test Euler
@autodiff struct DoubleIntegrator{D} <: DI{D} end
cmodel = DoubleIntegrator{2}()
n,m = size(cmodel)
n,m = RD.dims(cmodel)

# Evaluate Euler step explicitly
x0,u0 = randn(cmodel)
Expand Down
8 changes: 4 additions & 4 deletions test/liestate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ s = LieState{R,P}()
n = length(s)
= RD.errstate_dim(s)
G = zeros(n,n̄)
RobotDynamics.state_diff_jacobian!(s, G, x)
RobotDynamics.errstate_jacobian!(s, G, x)

q1 = UnitQuaternion(x[4],x[5],x[6],x[7])
q2 = UnitQuaternion(x[10],x[11],x[12],x[13])
Expand All @@ -92,7 +92,7 @@ dx = @SVector rand(n)

dq1 = SVector(dx[4],dx[5],dx[6],dx[7])
dq2 = SVector(dx[10],dx[11],dx[12],dx[13])
RobotDynamics.²differential!(s, ∇G, x, dx)
RobotDynamics.errstate_jacobian!(s, ∇G, x, dx)
∇G1 = Rotations.∇²differential(q1, dq1)
∇G2 = Rotations.∇²differential(q2, dq2)
∇G0 = cat(zeros(3,3), ∇G1, zeros(2,2), ∇G2, zeros(3,3), dims=(1,2))
Expand All @@ -106,7 +106,7 @@ model = LieBody()
@test s === LieState(model)
G .= 0
∇G .= 0
RobotDynamics.state_diff_jacobian!(model, G, x)
RobotDynamics.²differential!(model, ∇G, x, dx)
RobotDynamics.errstate_jacobian!(model, G, x)
RobotDynamics.errstate_jacobian!(model, ∇G, x, dx)
@test G0 G
@test ∇G0 ∇G
6 changes: 3 additions & 3 deletions test/rigid_body_jacobians.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ using RobotDynamics: orientation

# Set up model
model = Body{UnitQuaternion{Float64}}()
@test size(model) == (13, 6, 13)
@test RD.dims(model) == (13, 6, 13)
x, u = rand(model)
t, dt = 0, 0.1
z = RD.KnotPoint(x, u, t, dt)
Expand Down Expand Up @@ -72,14 +72,14 @@ dx = RobotDynamics.state_diff(model, x, x0)
G0 = Rotations.∇differential(q)
G = zeros(RD.state_dim(model), RobotDynamics.errstate_dim(model))
@test size(G) == (13, 12)
RD.state_diff_jacobian!(model, G, z)
RD.errstate_jacobian!(model, G, z)
@test G cat(I(3), G0, I(6), dims = (1, 2))

b = @SVector rand(13)
∇G0 = Rotations.∇²differential(q, b[SA[4, 5, 6, 7]])
∇G = zeros(RD.errstate_dim(model), RD.errstate_dim(model))
@test size(∇G) == (12, 12)
RobotDynamics.²differential!(model, ∇G, x, b)
RobotDynamics.errstate_jacobian!(model, ∇G, x, b)
@test ∇G cat(zeros(3, 3), ∇G0, zeros(6, 6), dims = (1, 2))

# @btime RobotDynamics.state_diff_jacobian!($G, $model, $z)
Expand Down

0 comments on commit 53c1501

Please sign in to comment.