Skip to content

Commit 16cbd48

Browse files
authored
Merge pull request #69 from janbruedigam/fix_linearization
Fix linearization
2 parents 0722fc0 + c69f0dd commit 16cbd48

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1818
Colors = "<0.12.10, 0.12.10"
1919
DocStringExtensions = "<0.9.3, 0.9.3"
2020
ForwardDiff = "<0.10.34, 0.10.34"
21-
GraphBasedSystems = "1.0, 1.1"
21+
GraphBasedSystems = "1.0, 1.2"
2222
LightXML = "<0.9.0, 0.9.0"
2323
Quaternions = "0.7.0, 0.7.4"
2424
Rotations = "1.0, 1.3"

src/main_components/system.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function create_system(origin::Origin{T}, eqconstraints::Vector{<:EqualityConstr
33
) where T
44

55
adjacency, dims = adjacencyMatrix(eqconstraints, bodies, frictions, ineqconstraints)
6-
system = System{T}(adjacency, dims)
6+
system = System{T}(adjacency, dims, force_static = true)
77

88
for eqc in eqconstraints
99
eqc.parentid == origin.id && (eqc.parentid = nothing)

src/optional_components/linearization.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,18 @@ function linearsystem(mechanism::Mechanism{T,Nn,Ne,Nb}, xθd, vωd, Fτd, contro
3131
ωd = [szeros(T,3) for i=1:Nb]
3232

3333
# store old state and set new initial state
34-
for (id,body) in pairs(mechanism.bodies)
35-
statesold[id] = deepcopy(body.state)
34+
for (i,body) in enumerate(mechanism.bodies)
35+
statesold[i] = deepcopy(body.state)
3636
end
3737
for (i,id) in enumerate(controlledids)
3838
setPosition!(mechanism, geteqconstraint(mechanism, id), [xθd[i]])
3939
end
40-
for (id,body) in pairs(mechanism.bodies)
40+
for (i,body) in enumerate(mechanism.bodies)
4141
state = body.state
42-
xd[id] = state.xc
43-
vd[id] = state.vc
44-
qd[id] = state.qc
45-
ωd[id] = state.ωc
42+
xd[i] = state.xc
43+
vd[i] = state.vc
44+
qd[i] = state.qc
45+
ωd[i] = state.ωc
4646
end
4747
for (i,id) in enumerate(controlids)
4848
setForce!(mechanism, geteqconstraint(mechanism, id), [Fτd[i]])
@@ -51,8 +51,8 @@ function linearsystem(mechanism::Mechanism{T,Nn,Ne,Nb}, xθd, vωd, Fτd, contro
5151
A, Bu, Bλ, G = lineardynamics(mechanism, controlids)
5252

5353
# restore old state
54-
for (id,body) in pairs(mechanism.bodies)
55-
body.state = statesold[id]
54+
for (i,body) in enumerate(mechanism.bodies)
55+
body.state = statesold[i]
5656
end
5757

5858
return A, Bu, Bλ, G, xd, vd, qd, ωd

0 commit comments

Comments
 (0)