Skip to content
Snippets Groups Projects
Commit 0047c953 authored by Fredrik Bagge Carlson's avatar Fredrik Bagge Carlson
Browse files

Start implement b&b simulator

parent 7b300cda
No related branches found
No related tags found
No related merge requests found
...@@ -10,8 +10,9 @@ BallAndBeam() = BallAndBeam(0.01, 0.0) ...@@ -10,8 +10,9 @@ BallAndBeam() = BallAndBeam(0.01, 0.0)
struct BallAndBeamSimulator <: SimulatedProcess struct BallAndBeamSimulator <: SimulatedProcess
h::Float64 h::Float64
state::Vector{Float64} # pos,vel,angle,ω
end end
BallAndBeamSimulator() = BallAndBeamSimulator(0.01) BallAndBeamSimulator() = BallAndBeamSimulator(0.01, zeros(4))
const BallAndBeamType = Union{BallAndBeam, BallAndBeamSimulator} const BallAndBeamType = Union{BallAndBeam, BallAndBeamSimulator}
num_outputs(p::BallAndBeamType) = 2 num_outputs(p::BallAndBeamType) = 2
...@@ -28,7 +29,7 @@ measure(p::BallAndBeam) = io2num(ccall((:comedi_read,comedipath), Int32, ...@@ -28,7 +29,7 @@ measure(p::BallAndBeam) = io2num(ccall((:comedi_read,comedipath), Int32,
(Int32,Int32,Int32), 0,0,0)) (Int32,Int32,Int32), 0,0,0))
control(p::BallAndBeamSimulator, u) = error("Not yet implemented") 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 comedipath = Pkg.dir("LabProcesses","c","comedi_bridge.so")
const conversion = 65535/20 const conversion = 65535/20
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment