Last active
September 10, 2019 10:37
-
-
Save zenfiric/08176905c03ece0aa4b63c56c6fd8899 to your computer and use it in GitHub Desktop.
The basic differential oscillator used for robots' CPGs in the Revolve project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(deSolve) | |
differential_oscilator <- function(t, y, parms) { | |
with(as.list(c(y, params)), expr = { | |
dx <- w_yx * y + bias_x | |
dy <- w_xy * x + bias_y | |
list(c(dx, dy)) | |
}) | |
} | |
times <- seq(from = 0, to = 20, by = 0.01) | |
yini <- c(x = 1, y = 1) | |
params <- c(w_xy = -1, w_yx = 1, bias_x = 0, bias_y = 0) | |
out <- ode(times = times, y = yini, func = differential_oscilator, parms = params) | |
plot(out) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment