Skip to content
Snippets Groups Projects
Commit 6013f772 authored by Julian Salt's avatar Julian Salt
Browse files

Update furuta.jl

parent cd872dd8
No related branches found
No related tags found
1 merge request!3WIP: Started furuta implementation
Pipeline #735 failed
......@@ -19,17 +19,27 @@ struct Furuta <: PhysicalProcess
h::Float64
bias::Float64
stream::LabStream
measure::AnalogInput10V
measure_phi::AnalogInput10V
measure_phi_dot::AnalogInput10V
measure_theta::AnalogInput10V
measure_theta_dot::AnalogInput10V
measure_theta_precise::AnalogInput10V
measure_theta_dot_precise::AnalogInput10V
control::AnalogOutput10V
end
function Furuta(;
h::Float64 = 0.01,
bias::Float64 = 0.,
stream::LabStream = ComediStream(),
measure::AnalogInput10V = AnalogInput10V(4),
measure_phi::AnalogInput10V = AnalogInput10V(4),
measure_phi_dot::AnalogInput10V = AnalogInput10V(5),
measure_theta::AnalogInput10V = AnalogInput10V(6),
measure_theta_dot::AnalogInput10V = AnalogInput10V(7),
measure_theta_precise::AnalogInput10V = AnalogInput10V(2),
measure_theta_dot_precise::AnalogInput10V = AnalogInput10V(3),
control::AnalogOutput10V = AnalogOutput10V(0))
p = Furuta(Float64(h),Float64(bias),stream,measure,control)
init_devices!(p.stream, p.measure, p.control)
p = Furuta(Float64(h),Float64(bias),stream,measure_phi,measure_phi_dot,measure_theta,measure_theta_dot,measure_theta_precise,measure_theta_dot_precise,control)
init_devices!(p.stream, p.measure_phi, p.measure_phi_dot, p.measure_theta, p.measure_theta_dot, p.measure_theta_precise, p.measure_theta_dot_precise, p.control)
p
end
......@@ -45,9 +55,9 @@ end
const AbstractFuruta = Union{Furuta, FurutaSimulator}
num_outputs(p::AbstractFuruta) = 1
num_inputs(p::AbstractFuruta) = 1
num_inputs(p::AbstractFuruta) = 6
outputrange(p::AbstractFuruta) = [(-10,10)]
inputrange(p::AbstractFuruta) = [(-10,10)]
inputrange(p::AbstractFuruta) = [(-10,10),(-10,10),(-10,10),(-10,10),(-10,10),(-10,10)]
isstable(p::AbstractFuruta) = false
isasstable(p::AbstractFuruta) = false
sampletime(p::AbstractFuruta) = p.h
......@@ -62,7 +72,13 @@ control(p::AbstractFuruta, u::Number) = send(p.control,u)
control(p::FurutaSimulator, u::Number) = p.s(u)
measure(p::Furuta) = read(p.measure)
measure_phi(p::Furuta) = read(p.measure_phi)
measure_phi_dot(p::Furuta) = read(p.measure_phi_dot)
measure_theta(p::Furuta) = read(p.measure_theta)
measure_theta_dot(p::Furuta) = read(p.measure_theta_dot)
measure_theta_precise(p::Furuta) = read(p.measure_theta_precise)
measure_theta_dot_precise(p::Furuta) = read(p.measure_theta_dot_precise)
measure(p::FurutaSimulator) = p.s.sys.C*p.s.state
initialize(p::Furuta) = nothing
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment