Dear Nest community,
I should import numerical data (not spiking data) obtained from a dynamic simulator called CoppeliaSim (ex VRep) into a Nest script. To do this I thought of using a ROS subscriber node that receives the data using a topic. I ask you, how do I interface Nest with Ros in order to import the data?
Greetings,
Except
Dear Salvatore,
first not a direct answer to your question, but if you are flexible and like to use NEST with a physics simulation via ROS interface you may want to check out the Neurorobotics Platform (https://zenodo.org/record/3571242) that connects NEST with Gazebo as a physics simulator via a ROS topics and a python interface. You can request an account on our website www.neurorobotics.net and try out the platform online without installation, but then also everything is open source and you can tweak it as you like.
More precisely answering your question: The easiest solution would probably be to use NEST in python, and then in the same python script set up your ROS publisher that sends data over to your ROS subscriber in CoppeliaSim. You will most likely need a transformation from spike train data to float values in order to control anything in your physics simulation, would be much easier to do this conversion before you send it over ROS topics. In the Neurorobotics Platform we use leaky-integrate and fire neurons with infinite threshold and read out its membrane voltage as a single float value in order to get a moving average of the spike data, something like an average spike rate. But this is only one possible solutions, it really depends on how your network looks like and what you like to do in your physics simulator.
[not a NEST developer, but working on the Neurorobotics Platform and its NEST integration for embodied spiking neural simulations]
Best,
Benedikt
On 25.05.22 17:47, salvatore.taffara@phd.unict.it wrote:
Dear Nest community,
I should import numerical data (not spiking data) obtained from a dynamic simulator called CoppeliaSim (ex VRep) into a Nest script. To do this I thought of using a ROS subscriber node that receives the data using a topic. I ask you, how do I interface Nest with Ros in order to import the data?
Greetings,
Except _______________________________________________ NEST Users mailing list -- users@nest-simulator.org To unsubscribe send an email to users-leave@nest-simulator.org
"The easiest solution would probably be to use NEST in python, and then in the same python script set up your ROS publisher that sends data over to your ROS subscriber in CoppeliaSim"
How can I use Ros in a Nest script if in Nest there is not a Ros interface with API functions?
Have a look at this tutorial on how to write a ROS publisher in a python script http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28python%29
In the same script you can then also import NEST (import nest) and set up your network.
Be aware that simulations with this setup will not be deterministic, since both physics simulation in CopeliaSim and neural simulation in NEST just take as long as they need for one simulation step, and this depends heavily on the computer performance and model/network implemented. You would need to step both CopeliaSim and NEST in order to achieve deterministic simulations, but I am not sure if and how this would work with CopeliaSim.
Best,
Benedikt
On 25.05.22 18:09, salvatore.taffara@phd.unict.it wrote:
"The easiest solution would probably be to use NEST in python, and then in the same python script set up your ROS publisher that sends data over to your ROS subscriber in CoppeliaSim"
How can I use Ros in a Nest script if in Nest there is not a Ros interface with API functions? _______________________________________________ NEST Users mailing list -- users@nest-simulator.org To unsubscribe send an email to users-leave@nest-simulator.org
If I compile the Subscriber in which there is the "import nest" command I obtain: salvo@salvo-Aspire-GX-781:~$ rosrun pacchetto_ros sub_vrep.py Traceback (most recent call last): File "/home/salvo/Desktop/ros_ws/src/pacchetto_ros/scripts/sub_vrep.py", line 5, in <module> import vrep ImportError: No module named vrep
Sorry, the correct output when I use "import nest" in the Subscriber is:
salvo@salvo-Aspire-GX-781:~/Desktop/ros_ws/src/pacchetto_ros/scripts$ rosrun pacchetto_ros sub_vrep.py Traceback (most recent call last): File "/home/salvo/Desktop/ros_ws/src/pacchetto_ros/scripts/sub_vrep.py", line 5, in <module> import nest File "/usr/lib/python3.6/dist-packages/nest/__init__.py", line 26, in <module> from . import ll_api # noqa File "/usr/lib/python3.6/dist-packages/nest/ll_api.py", line 72, in <module> from . import pynestkernel as kernel # noqa ImportError: dynamic module does not define init function (initpynestkernel)
The problem is maybe due to the fact that to import nest i have to use python3 but Melodic is based on python2...
If I use the rosrun command I have: salvo@salvo-Aspire-GX-781:~/Desktop/ros_ws/src/pacchetto_ros/scripts$ rosrun pacchetto_ros sub_vrep.py Traceback (most recent call last): File "/home/salvo/Desktop/ros_ws/src/pacchetto_ros/scripts/sub_vrep.py", line 5, in <module> import nest File "/usr/lib/python3.6/dist-packages/nest/__init__.py", line 26, in <module> from . import ll_api # noqa File "/usr/lib/python3.6/dist-packages/nest/ll_api.py", line 72, in <module> from . import pynestkernel as kernel # noqa ImportError: dynamic module does not define init function (initpynestkernel)
The problem maybe is due to the fact that to import nest i have to use python3 but Melodic is based on python2...
Hi!
NEST 3.x (which is definitely what you should use) is indeed Python 3 only. Python 2 has been dead now since two and a half years... Here's an article on how to build ROS with support for Python 3:
https://www.miguelalonsojr.com/blog/robotics/ros/python3/2019/08/20/ros-melo...
Cheers, Jochen!
On 26.05.22 11:14, salvatore.taffara@phd.unict.it wrote:
If I use the rosrun command I have: salvo@salvo-Aspire-GX-781:~/Desktop/ros_ws/src/pacchetto_ros/scripts$ rosrun pacchetto_ros sub_vrep.py Traceback (most recent call last): File "/home/salvo/Desktop/ros_ws/src/pacchetto_ros/scripts/sub_vrep.py", line 5, in <module> import nest File "/usr/lib/python3.6/dist-packages/nest/__init__.py", line 26, in
<module> from . import ll_api # noqa File "/usr/lib/python3.6/dist-packages/nest/ll_api.py", line 72, in <module> from . import pynestkernel as kernel # noqa ImportError: dynamic module does not define init function (initpynestkernel)
The problem maybe is due to the fact that to import nest i have to use python3 but Melodic is based on python2... _______________________________________________ NEST Users mailing list -- users@nest-simulator.org To unsubscribe send an email to users-leave@nest-simulator.org