Skip to content

Commit 475312c

Browse files
committed
Add WrenchesCache and bump version to 2.5.0
1 parent 10de215 commit 475312c

4 files changed

Lines changed: 30 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ jobs:
1818
matrix:
1919
version:
2020
- 'lts'
21-
- '1.6'
2221
- '1.9' # Temporary for notebooks
2322
- '1.11'
2423
os:

Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "RigidBodyDynamics"
22
uuid = "366cf18f-59d5-5db9-a4de-86a9f6786172"
3-
version = "2.4.0"
3+
version = "2.5.0"
44

55
[deps]
66
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
@@ -19,8 +19,8 @@ UnsafeArrays = "c4a57d5a-5b31-53a6-b365-19f8c011fbd6"
1919
DocStringExtensions = "0.4.1, 0.5, 0.6, 0.7, 0.8, 0.9"
2020
LightXML = "0.8, 0.9"
2121
LoopThrottle = "0.1"
22-
Reexport = "0.2, 1.0"
23-
Rotations = "1.1 - 1.2"
22+
Reexport = "0.2, 1"
23+
Rotations = "1"
2424
StaticArrays = "0.8, 0.9, 0.10, 0.11, 0.12, 1"
2525
TypeSortedCollections = "1"
2626
UnsafeArrays = "1"

src/RigidBodyDynamics.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ export
2121
DynamicsResult,
2222
StateCache,
2323
DynamicsResultCache,
24-
SegmentedVectorCache
24+
SegmentedVectorCache,
25+
WrenchesCache
2526

2627
# specific joint types
2728
export

src/caches.jl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,28 @@ end
107107
@inline function makevalue(c::SegmentedVectorCache{K, KeyRange}, ::Type{T}) where {K, T, KeyRange}
108108
SegmentedVector{K, T, KeyRange}(Vector{T}(undef, c.length), c.ranges)
109109
end
110+
111+
"""
112+
$(TYPEDEF)
113+
114+
A container that manages the creation and storage of `BodyDict{Wrench{T}}`.
115+
Similar to [`StateCache`](@ref).
116+
"""
117+
struct WrenchesCache{M} <: AbstractTypeDict
118+
mechanism::Mechanism{M}
119+
keys::Vector{UInt}
120+
values::Vector # Can also be `Any`
121+
end
122+
123+
Base.show(io::IO, ::WrenchesCache{M}) where {M} = print(io, "WrenchesCache{$M}(…)")
124+
125+
WrenchesCache(mechanism::Mechanism{M}) where {M} = WrenchesCache{M}(mechanism, [], [])
126+
127+
@inline function valuetype(::Type{WrenchesCache{M}}, ::Type{T}) where {M,T}
128+
BodyDict{Wrench{T}}
129+
end
130+
131+
@inline function makevalue(c::WrenchesCache, ::Type{T}) where {T}
132+
rootframe = root_frame(c.mechanism)
133+
BodyDict{Wrench{T}}(b => zero(Wrench{T}, rootframe) for b in bodies(c.mechanism))
134+
end

0 commit comments

Comments
 (0)