From 0047c953156941db0f3436f629195446dd5d58d7 Mon Sep 17 00:00:00 2001 From: Fredrik Bagge Carlson <cont-frb@ulund.org> Date: Mon, 21 Aug 2017 15:58:11 +0200 Subject: [PATCH] Start implement b&b simulator --- src/interface_implementations/ballandbeam.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/interface_implementations/ballandbeam.jl b/src/interface_implementations/ballandbeam.jl index 6e9a8fd..e4a8a63 100644 --- a/src/interface_implementations/ballandbeam.jl +++ b/src/interface_implementations/ballandbeam.jl @@ -10,8 +10,9 @@ BallAndBeam() = BallAndBeam(0.01, 0.0) struct BallAndBeamSimulator <: SimulatedProcess h::Float64 + state::Vector{Float64} # pos,vel,angle,ω end -BallAndBeamSimulator() = BallAndBeamSimulator(0.01) +BallAndBeamSimulator() = BallAndBeamSimulator(0.01, zeros(4)) const BallAndBeamType = Union{BallAndBeam, BallAndBeamSimulator} num_outputs(p::BallAndBeamType) = 2 @@ -28,7 +29,7 @@ measure(p::BallAndBeam) = io2num(ccall((:comedi_read,comedipath), Int32, (Int32,Int32,Int32), 0,0,0)) control(p::BallAndBeamSimulator, u) = error("Not yet implemented") -measure(p::BallAndBeamSimulator) = error("Not yet implemented") +measure(p::BallAndBeamSimulator) = [p.state[1], p.state[3]] const comedipath = Pkg.dir("LabProcesses","c","comedi_bridge.so") const conversion = 65535/20 -- GitLab