3/24/2020 1
Neural Control Systems: An introduction
Federico Nesti, f.nesti@santannapisa.it Federico Nesti, f.nesti@santannapisa.it
Credits: Brian Douglas
Neural Control Systems: An introduction Federico Nesti, - - PDF document
3/24/2020 Neural Control Systems: An introduction Federico Nesti, f.nesti@santannapisa.it Federico Nesti, f.nesti@santannapisa.it Credits: Brian Douglas 1 3/24/2020 Layout Introduction to Dynamical Systems o What is a dynamical system?
Federico Nesti, f.nesti@santannapisa.it Federico Nesti, f.nesti@santannapisa.it
Credits: Brian Douglas
A Control System is intended to regulate the system state in a specified manner through the action of a Controller (and usually a
Reference Control input error
specified manner through the action of a Controller (and usually a Feedback signal, that makes it a Closed Loop Control System).
State feedback
1) Choose equilibrium where to control the system (e.g., upright) 2) Linearize the system on that equilibrium, check stability 3) Design gain of proportional controller
Null Velocity
Stability of equilibria is critical: down position is clearly stable, upright is UNSTABLE! How to state this? UNSTABLE! How to state this?
«residual» system linear and much simpler to analyze (linear algebra tools).
How to control the plant in the unstable ilib i ? equilibrium? Add state feedback.
Control input
i t environments
custom environments https://gym.openai.com/
Simple gym installation:
$ pip install gym Custom gym installation (needs Mujoco dependency): $ git clone http://github.com/openai/gym $ cd gym gym$ pip install –e ‘.[all]’ --user
Custom environment installation: C f ld
/ /
and gym/envs/custom/__init__.py
register(id=‘foo-v0’, entry_point=‘gym.envs.custom:Foo’,)
Reinstall gym
Initialization: import gym
env = gym.make(env_name) Spaces: env.observation_space env.action_space Methods:
Discrete or Box (i.e., continuous)
Methods:
import gym env = gym.make(‘CartPole-v0’) s = env.reset() for i in range(N): env.render() s_, r, d, _ = env.step(env.action_space.sample())
Some environments are free and open-source: Atari, box2D, classic
control, algorithms, toy text.
The environments in MuJoCo and Robotics need an external dependency on a physics simulator, called MuJoCo.
To install MuJoCo: G t htt // b ti /li ht l d bt i 30 d t i l li ( t d t l)
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/(username)/.mujoco/mujoco200 /bin”, then execute source ~/.bashrc
To install MuJoCo:
$ cd mujoco py
libssl-dev libffi-dev libxml2-dev libxslt1-dev zlib1g-dev libglew1.5 libglew- dev python-pip libgl1-mesa-dev +libgl1-mesa-glx libosmesa6-dev python3-numpy python3-scipy libglfw3-dev
j $ d th 3 t d l
Walkthrough Jupyter Notebook. Basic concepts:
Training process
Output Input
Random amplitude and duration input generation Next state computation and noise addition
Predicted Actual
Reference Model
NN controller Learning
+ Learning model NN
This is why this net is a RECURRENT net! Controller output depends on previous p p
The architecture can be NN NN Model Model LOSS unrolled to clarify the temporal dependency. controller controller Model Model LOSS
Backpropagation through time Model NN NN Model LOSS Model controller controller Model LOSS
Angle [rad]
Target Reference Actual
Time Steps