Hello Sebastian,
Since I am working with Matthias on that problem and it occurred in my part of the code I will write you a minimal example here. The transfer function looks like this:
from std_msgs.msg import Float64
from gazebo_ros_muscle_interface.msg import MuscleStates
from gazebo_msgs.msg import LinkStates
from sensor_msgs.msg import JointState
@nrp.MapSpikeSource("test_pop", nrp.brain.refl_neurons, nrp.poisson)
@nrp.MapRobotSubscriber("muscle_states_msg", Topic("/gazebo_muscle_interface/myoarm/muscle_states", MuscleStates))
@nrp.MapRobotSubscriber("link_states_msg", Topic("/gazebo/link_states", gazebo_msgs.msg.LinkStates))
@nrp.MapRobotSubscriber("joint_states_msg", Topic("/joint_states", sensor_msgs.msg.JointState))
@nrp.MapCSVRecorder("recorder", filename="angles.csv", headers=["time", "shoulder", "elbow"])
@nrp.Robot2Neuron()
def setNeurons(t, test_pop, muscle_states_msg, link_states_msg, joint_states_msg, recorder):
import numpy as np
# test_pop.rate = [50.]*100
# test_pop.rate = np.linspace(50.0, 50.0, num = 100)
test_pop.rate = 50.0
clientLogger.info(test_pop.rate )
The two commented out attempts of setting the rate lead to the error messages Matthias stated in his earlier post. If I only set one number, like here for example 50.0 as a rate, it runs, however all neurons of the post synaptic population (here defined as refl_neurons
in the brain model with n = 100) spike at the same time, like seen in the image from the spike train below:
while we would actually expect different spike times, but the same spike rate for the each individual neuron, especially when connected OneToOne. Something like this:
So this is what we want to achieve for the postsynaptic population. Please correct us, if our expectations are wrong.
When setting the spike times in the brain model directly, like
test_pop.rate = 50.0
I get a spiking poisson population, but it does not seem to trigger any spikes in a post-synaptic population…
Since it is mentioned in this post, that the PoissonGenerator should be defined in the transfer function, because the rate has to be updated in every time step, we used the MapSpikeSource.
I hope this is understandable.
Annika