From 18b5e616e83ffc202348c4c3c721b8a3592d82c0 Mon Sep 17 00:00:00 2001 From: Robin Deits Date: Wed, 28 Feb 2018 01:32:04 -0500 Subject: [PATCH 1/5] remove unused methods --- src/animate.jl | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/animate.jl b/src/animate.jl index 89c6882..fd4694e 100644 --- a/src/animate.jl +++ b/src/animate.jl @@ -11,14 +11,6 @@ end Base.one(::Type{InterpolatableArray{A}}) where {A} = 1 Base.:*(n::Number, a::InterpolatableArray) = n * a.data -rbd.normalize_configuration!(joint_type::JointType, q) = nothing -function rbd.normalize_configuration!(joint_type::QuaternionFloating, q) - n = norm(q[1:4]) - for i = 1:4 - q[i] /= n - end -end - """ animate(vis::MechanismVisualizer, times::Vector{Float64}, From 3b2465f8b406e86660b0d266c46e9b65506d8c3f Mon Sep 17 00:00:00 2001 From: Robin Deits Date: Wed, 28 Feb 2018 01:33:52 -0500 Subject: [PATCH 2/5] conversion to Symbol is unnecessary --- src/visualizer.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/visualizer.jl b/src/visualizer.jl index af4f1b2..985a6d1 100644 --- a/src/visualizer.jl +++ b/src/visualizer.jl @@ -30,12 +30,12 @@ function _set_mechanism!(mvis::MechanismVisualizer, frame_to_visuals) body_ancestors = rbd.Graphs.ancestors(vertex, tree) for definition in rbd.frame_definitions(body) frame = definition.from - path = Symbol.(vcat(string.(reverse(body_ancestors)), string(frame))) + path = vcat(string.(reverse(body_ancestors)), string(frame)) frame_vis = vis[path...] if frame in keys(frame_to_visuals) settransform!(frame_vis, to_affine_map(definition)) for (i, (object, tform)) in enumerate(frame_to_visuals[frame]) - obj_vis = frame_vis[Symbol("geometry_", i)] + obj_vis = frame_vis["geometry_$i")] setobject!(obj_vis, object) settransform!(obj_vis, tform) end @@ -58,7 +58,7 @@ function _render_state!(mvis::MechanismVisualizer, state::MechanismState=mvis.st settransform!(vis, to_affine_map(transform_to_root(state, body))) else body_ancestors = rbd.Graphs.ancestors(vertex, tree) - path = Symbol.(string.(reverse(body_ancestors))) + path = string.(reverse(body_ancestors)) tform = relative_transform(state, default_frame(body), default_frame(body_ancestors[2])) settransform!(vis[path...], to_affine_map(tform)) end From d675639e6bc3a2732cc3d8e372fd254691802244 Mon Sep 17 00:00:00 2001 From: Robin Deits Date: Wed, 28 Feb 2018 01:40:42 -0500 Subject: [PATCH 3/5] fix typo --- src/visualizer.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/visualizer.jl b/src/visualizer.jl index 985a6d1..f533c53 100644 --- a/src/visualizer.jl +++ b/src/visualizer.jl @@ -35,7 +35,7 @@ function _set_mechanism!(mvis::MechanismVisualizer, frame_to_visuals) if frame in keys(frame_to_visuals) settransform!(frame_vis, to_affine_map(definition)) for (i, (object, tform)) in enumerate(frame_to_visuals[frame]) - obj_vis = frame_vis["geometry_$i")] + obj_vis = frame_vis["geometry_$i"] setobject!(obj_vis, object) settransform!(obj_vis, tform) end From c61c14692b0ede5d0ff920a2b71ea5e66b6cd71f Mon Sep 17 00:00:00 2001 From: Robin Deits Date: Wed, 28 Feb 2018 01:40:47 -0500 Subject: [PATCH 4/5] InterpolatableArray is no longer necessary! --- src/animate.jl | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/src/animate.jl b/src/animate.jl index fd4694e..cbc7182 100644 --- a/src/animate.jl +++ b/src/animate.jl @@ -1,16 +1,3 @@ -""" -Interpolations.jl requires that one(::Type{T}) be defined for any data -type we want to interpolate. Rather than defining one(::Type{Vector}) here, -which might have unforeseen consequences in other packages, we'll create -a very simple wrapper type that just knows one() and * -""" -struct InterpolatableArray{A <: AbstractArray} - data::A -end - -Base.one(::Type{InterpolatableArray{A}}) where {A} = 1 -Base.:*(n::Number, a::InterpolatableArray) = n * a.data - """ animate(vis::MechanismVisualizer, times::Vector{Float64}, @@ -28,8 +15,7 @@ function animate(vis::MechanismVisualizer, @assert 0 < realtimerate < Inf state = vis.state - interp_values = [InterpolatableArray(c) for c in configurations] - interpolated_configurations = interpolate((times,), interp_values, Gridded(Linear())) + interpolated_configurations = interpolate((times,), configurations, Gridded(Linear())) t0, tf = first(times), last(times) framenum = 0 walltime0 = time() @@ -45,5 +31,5 @@ function animate(vis::MechanismVisualizer, end animate(mechanism::Mechanism, times::Vector{Float64}, - configurations::Vector{Vector{Float64}}) = - animate(Visualizer(mechanism), mechanism, times, configurations) + configurations::Vector{Vector{Float64}}; kw...) = + animate(MechanismVisualizer(mechanism), times, configurations; kw...) From 956cf86169058e5142ad3c8fa5b30f7e580061ba Mon Sep 17 00:00:00 2001 From: Robin Deits Date: Wed, 28 Feb 2018 01:46:19 -0500 Subject: [PATCH 5/5] remove unused method --- src/animate.jl | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/animate.jl b/src/animate.jl index cbc7182..237c2c9 100644 --- a/src/animate.jl +++ b/src/animate.jl @@ -29,7 +29,3 @@ function animate(vis::MechanismVisualizer, t == tf && break end max_rate = fps end - -animate(mechanism::Mechanism, times::Vector{Float64}, - configurations::Vector{Vector{Float64}}; kw...) = - animate(MechanismVisualizer(mechanism), times, configurations; kw...)