Skip to content

Commit

Permalink
Merge pull request #36 from janbruedigam/small_updates
Browse files Browse the repository at this point in the history
Small updates
  • Loading branch information
janbruedigam authored Oct 18, 2020
2 parents 9fab69a + 891fa9a commit 334a778
Show file tree
Hide file tree
Showing 34 changed files with 583 additions and 780 deletions.
72 changes: 33 additions & 39 deletions src/ConstrainedDynamics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@ using Rotations: RotationError, pure_quaternion, params, lmult, rmult, tmat, vma
using Colors: RGBA, RGB
using LightXML

export Box,
Cylinder,
Sphere,
Mesh,

UnitQuaternion,
Origin,
export Origin,
Body,
EqualityConstraint,
InequalityConstraint,
Mechanism,
LinearMechanism,
Storage,
Controller,
Storage,
UnitQuaternion,

Box,
Cylinder,
Sphere,
Mesh,

Floating,
Prismatic,
Expand All @@ -38,25 +39,23 @@ export Box,

Impact,
Friction,
UnitQuaternion,

setPosition!,
setVelocity!,
setForce!,
simulate!,
initializeConstraints!,

disassemble,
getid,
getcomponent,
getbody,
geteqconstraint,
getineqconstraint,
simulate!,
initializeConstraints!,
disassemble,
minimalCoordinates,
activate!,
deactivate!,

linearsystem,

RotX,
RotY,
RotZ,
Expand All @@ -66,56 +65,51 @@ export Box,
sones,
srand


include(joinpath("util", "util.jl"))
include(joinpath("util", "custom_static.jl"))
include(joinpath("util", "customdict.jl"))
include(joinpath("util", "quaternion.jl"))
include(joinpath("util", "shapes.jl"))

include(joinpath("components", "component.jl"))
include(joinpath("components", "state.jl"))
include(joinpath("components", "body.jl"))
include(joinpath("optional_components", "shapes.jl"))
include(joinpath("optional_components", "storage.jl"))

include(joinpath("joints", "joint.jl"))
include(joinpath("bounds", "bound.jl"))
include(joinpath("main_components", "component.jl"))
include(joinpath("main_components", "state.jl"))
include(joinpath("main_components", "body.jl"))
include(joinpath("main_components", "equalityconstraint.jl"))
include(joinpath("main_components", "inequalityconstraint.jl"))
include(joinpath("main_components", "graph.jl"))
include(joinpath("main_components", "controller.jl"))
include(joinpath("main_components", "sparseldu.jl"))
include(joinpath("main_components", "mechanism_struct.jl"))
include(joinpath("main_components", "mechanism_functions.jl"))

include(joinpath("joints", "abstract_joint.jl"))

include(joinpath("joints", "joint.jl"))
include(joinpath("joints", "translational.jl"))
include(joinpath("joints", "rotational.jl"))
include(joinpath("joints", "genericjoint.jl"))
include(joinpath("joints", "prototypes.jl"))

include(joinpath("bounds", "bound.jl"))
include(joinpath("bounds", "contact.jl"))
include(joinpath("bounds", "impact.jl"))
include(joinpath("bounds", "friction.jl"))

include(joinpath("components", "equalityconstraint.jl"))
include(joinpath("components", "inequalityconstraint.jl"))

include(joinpath("util", "graph.jl"))
include(joinpath("util", "storage.jl"))

include(joinpath("components", "controller.jl"))

include(joinpath("solver", "sparseldu.jl"))
include(joinpath("components", "mechanism.jl"))
include(joinpath("components", "linear_mechanism.jl"))
include(joinpath("components", "mechanism_functions.jl"))
include(joinpath("components", "mechanism_ui.jl"))
include(joinpath("components", "simulate.jl"))
include(joinpath("components", "initialize.jl"))
include(joinpath("solver", "solverfunctions.jl"))
include(joinpath("solver", "system.jl"))
include(joinpath("solver", "initconstraints.jl"))

include(joinpath("util", "urdf.jl"))

include(joinpath("solver", "newton.jl"))
include(joinpath("solver", "linesearch.jl"))


include(joinpath("discretization", "SymplecticEuler.jl"))
# include(joinpath("discretization", "ImplicitTrapezoid.jl"))

include(joinpath("ui", "mechanism_ui.jl"))
include(joinpath("ui", "simulate.jl"))
include(joinpath("ui", "initialize.jl"))
include(joinpath("ui", "urdf.jl"))


end
4 changes: 3 additions & 1 deletion src/bounds/bound.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
abstract type Bound{T} end

Base.show(io::IO, bound::Bound) = summary(io, bound)
function Base.show(io::IO, mime::MIME{Symbol("text/plain")}, bound::Bound{T}) where {T}
summary(io, bound)
end

@inline getT(bound::Bound{T}) where T = T

Expand Down
15 changes: 12 additions & 3 deletions src/bounds/friction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ mutable struct Friction{T} <: Contact{T}
Nx::Adjoint{T,SVector{6,T}}
D::SMatrix{2,6,T,12}
cf::T
b::SVector{2,T}
offset::SVector{6,T}

b::SVector{2,T}


function Friction(body::Body{T}, normal::AbstractVector, cf::Real; offset::AbstractVector = zeros(3)) where T
@assert cf>0
Expand All @@ -18,10 +18,19 @@ mutable struct Friction{T} <: Contact{T}
D = [[V1 V2];szeros(3,2)]'
offset = [offset;0.0;0.0;0.0]

new{T}(Nx, D, cf, zeros(2),offset), body.id
new{T}(Nx, D, cf, offset, zeros(2)), body.id
end
end

function Base.show(io::IO, mime::MIME{Symbol("text/plain")}, constraint::Friction{T}) where {T}
summary(io, constraint)
println(io,"")
println(io, " Nx: "*string(constraint.Nx))
println(io, " D: "*string(constraint.D))
println(io, " cf: "*string(constraint.cf))
println(io, " offset: "*string(constraint.offset))
end


@inline additionalforce(friction::Friction) = friction.D'*friction.b
@inline function calcFrictionForce!(mechanism, ineqc, friction::Friction, i, body::Body)
Expand Down
7 changes: 7 additions & 0 deletions src/bounds/impact.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ mutable struct Impact{T} <: Contact{T}
new{T}(Nx, offset), body.id
end
end

function Base.show(io::IO, mime::MIME{Symbol("text/plain")}, constraint::Impact{T}) where {T}
summary(io, constraint)
println(io,"")
println(io, " Nx: "*string(constraint.Nx))
println(io, " offset: "*string(constraint.offset))
end
74 changes: 0 additions & 74 deletions src/components/linear_mechanism.jl

This file was deleted.

Loading

0 comments on commit 334a778

Please sign in to comment.