Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New contact #580

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2a0fa7c
Add CatVector.
tkoolen Jun 29, 2019
350896c
Add similar for CatVector
tkoolen Jun 29, 2019
b43949b
Add copyto, map for CatVector.
tkoolen Jun 29, 2019
53886a6
Add broadcast for CatVector. Works, but it's pretty slow.
tkoolen Jun 29, 2019
5ad06ac
Faster broadcast.
tkoolen Jun 29, 2019
e46a068
Minor tweaks.
tkoolen Dec 31, 2019
ac27a70
Add docstring.
tkoolen Dec 31, 2019
a7d3567
Broadcast improvements.
tkoolen Dec 31, 2019
0bb8b92
Rip out old contact code.
tkoolen Jun 24, 2019
00daf54
Gut Contact module, move into its own directory, return vectors inste…
tkoolen Jun 24, 2019
4fea745
Start fleshing out new contact stuff.
tkoolen Dec 28, 2019
2555183
More progress on new contact stuff.
tkoolen Jun 25, 2019
af1cba8
Distinguish between OdeIntegrators.{configuration, velocity, ...} and…
tkoolen Jun 25, 2019
0c485e8
Contact bug fixes. Starting to work.
tkoolen Jun 25, 2019
6a4f28e
Get rid of default OdeIntegrator method implementations.
tkoolen Jun 25, 2019
955fd47
Minor tweaks.
tkoolen Jun 26, 2019
9cdec1f
Reset caches.
tkoolen Jun 26, 2019
8890cd5
Handle HalfSpaces again, tweaks.
tkoolen Jun 26, 2019
665778d
Just use relative_twist
tkoolen Jun 28, 2019
c9d5065
Remove unused normals var.
tkoolen Jul 1, 2019
11fa82d
Temporarily re-add additional state related stuff for MechanismState.
tkoolen Jul 1, 2019
dabe5eb
Adapt to EnhancedGJK changes. Untested.
tkoolen Jul 3, 2019
a8c8e9b
Halfspace caching.
tkoolen Jul 5, 2019
724d3fd
AbstractAffineMap -> Transform3D constructors.
tkoolen Jul 7, 2019
3c471cf
Add HRep, specialize collision checking for point-to-hrep.
tkoolen Jul 16, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ uuid = "366cf18f-59d5-5db9-a4de-86a9f6786172"
version = "2.2.0"

[deps]
CoordinateTransformations = "150eb455-5306-5404-9cee-2592286d6298"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
EnhancedGJK = "3d39a06a-b57e-5769-b499-4d62b23c243f"
GeometryTypes = "4d00f742-c7ba-57c2-abde-4428a4b178cb"
LightXML = "9c8b4983-aa76-5018-a973-4c85ecc9e179"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LoopThrottle = "39f5be34-8529-5463-bac7-bf6867c840a3"
Expand Down
7 changes: 4 additions & 3 deletions src/RigidBodyDynamics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,14 @@ export
include(joinpath("custom_collections", "custom_collections.jl"))
include(joinpath("graphs", "Graphs.jl"))
include(joinpath("spatial", "Spatial.jl"))
include("contact.jl")
include("ode_integrators.jl")
include("pdcontrol.jl")

@reexport using .Spatial
using .CustomCollections
using .Contact
using .Graphs
using .PDControl
using .OdeIntegrators

import .Spatial: rotation, translation, transform, center_of_mass, newton_euler, kinetic_energy

Expand All @@ -185,12 +185,13 @@ include("mechanism_state.jl")
include("dynamics_result.jl")
include("caches.jl")
include("mechanism_algorithms.jl")
include("ode_integrators.jl")
include("simulate.jl")

include(joinpath("urdf", "URDF.jl"))
@reexport using .URDF

include(joinpath("contact", "Contact.jl"))

# import these for MechanismGeometries compatibility. TODO: stop importing these after updating MechanismGeometries.
import .URDF: parse_scalar, parse_vector, parse_pose

Expand Down
251 changes: 0 additions & 251 deletions src/contact.jl

This file was deleted.

74 changes: 74 additions & 0 deletions src/contact/Contact.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
module Contact

using RigidBodyDynamics

using LinearAlgebra
using RigidBodyDynamics.Spatial
using StaticArrays
using TypeSortedCollections
using EnhancedGJK
using DocStringExtensions

import GeometryTypes
import CoordinateTransformations

using RigidBodyDynamics: update_transforms!, update_twists_wrt_world!
using RigidBodyDynamics: frame_definition
using RigidBodyDynamics.CustomCollections: UnorderedPair
using CoordinateTransformations: Transformation, AffineMap, LinearMap, Translation, IdentityTransformation
using CoordinateTransformations: transform_deriv

# base types
export
ContactForceModel,
CollisionElement,
CollisionGroup,
ContactModel,
SoftContactState,
SoftContactResult

# geometry
export
HalfSpace,
HRep

# interface functions
export
set_contact_force_model!,
contact_dynamics

# specific models
export
SplitContactForceModel,
HuntCrossleyModel,
hunt_crossley_hertz,
ViscoelasticCoulombModel

# TODO: move this somewhere else
CoordinateTransformations.AffineMap(tf::Transform3D) = AffineMap(rotation(tf), translation(tf))

function RigidBodyDynamics.Transform3D(from::CartesianFrame3D, to::CartesianFrame3D, map::AffineMap)
Transform3D(from, to, map.linear, map.translation)
end

function RigidBodyDynamics.Transform3D(from::CartesianFrame3D, to::CartesianFrame3D, map::LinearMap)
Transform3D(from, to, map.linear)
end

function RigidBodyDynamics.Transform3D(from::CartesianFrame3D, to::CartesianFrame3D, map::Translation)
Transform3D(from, to, map.translation)
end

include("halfspace.jl")
include("hrep.jl")
include("collision_element.jl")
include("contact_force_model.jl")
include("collidable_pair.jl")
include("collision_detection.jl")
include("contact_model.jl")
include("soft_contact_state.jl")

include("hunt_crossley.jl")
include("viscoelastic_coulomb.jl")

end # module
16 changes: 16 additions & 0 deletions src/contact/collidable_pair.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
struct CollidablePair{A<:CollisionElement, B<:CollisionElement, M<:ContactForceModel}
a::A
b::B
model::M
end

# struct GJKCollisionCache{G<:EnhancedGJK.CollisionCache}
# gjk_cache::G
# penetrated_face::TODO
# end
# PointGJKCollisionCache(gjk_cache::EnhancedGJK.CollisionCache) = PointGJKCollisionCache(gjk_cache, Ref(zero(UInt8)))
# function PointGJKCollisionCache(pair::CollidablePair)
# @assert pair.a.geometry isa GeometryTypes.Point || pair.b.geometry isa GeometryTypes.Point
# PointGJKCollisionCache(CollisionCache(pair.a.geometry, pair.b.geometry))
# end

Loading