INCF / MUSIC

MUSIC, the MUltiSimulation Coordinator
GNU General Public License v3.0
37 stars 37 forks source link

The ROS-MUSIC toolchain #42

Closed Aamanen closed 6 years ago

Aamanen commented 6 years ago

Im trying to follow the procedure described by Weidel, Djurfeldt, Duarte and Morrison in "Closed Loop Interactions betweenSpiking Neural Network and RoboticSimulators Based on MUSIC and ROS"

I have NEST, ROS and MUSIC installed and openmpi and other dependencies. When running my MUSIC configuration file i recieve errors, and I have tried different both relative and absolute paths to the "ros_sensor_adapter" that is installed in the /opt/MUSIC-master/ros/adapters

`~/catkin_ws/src/ros_music_adapter-master/examples/braitenberg3$ mpirun -np 6 music fable.music

Primary job terminated normally, but 1 process returned a non-zero exit code.. Per user-direction, the job has been aborted.

Error during launching of binary ros_sensor_adapter MUSIC: No such file or directory Error during launching of binary connect_adapter MUSIC: No such file or directory Error during launching of binary rate_encoder MUSIC: No such file or directory `


The fable.music contains the MUSIC configuration code: stoptime=1000. music_timestep=0.05 rtf=1 [sensor] binary=ros_sensor_adapter args= np=1 ros_topic=/fableassem/joint_states message_type=Float64MultiArray sensor_update_rate=20 [converge] binary=connect_adapter args= np=1 weights_filename=braitenberg3_converge_weights.dat [encoder] binary=rate_encoder args= np=1 rate_min=1 rate_max=200 [nest] binary=./pynesttest.py args=-s 0.05 -t 1000 -n 2 np=1 [decoder] binary=linear_readout_decoder args= np=1 tau=0.03 weights_filename=braitenberg3_readout_weights.dat [command] binary=ros_command_adapter args= np=1 ros_topic=/fableassem/joint1_torque_controller message_mapping_filename=braitenberg3_twist_mapping.dat command_rate=10 sensor.out->converge.in[20] converge.out->encoder.in[2] encoder.out->nest.in[2] nest.out->decoder.in[2] decoder.out->command.in[2]

mdjurfeldt commented 6 years ago

Hi,

Most likely, this is still the problem that the binaries can't be found.

What kind of machine are you running this on?

And did you really try:

binary=/opt/MUSIC-master/ros/adapters/ros_sensor_adapter

etc?

(Note also that the statements under a [...] section should be indented---but this maybe just disappeared when you copied the file into this issue?)

mdjurfeldt commented 6 years ago

Also, /opt/MUSIC-master/ros/adapters seems like a strange location. Are you sure that the ros_sensor_adapter binary is in that directory? Please make sure that the absolute path given to binary= actually points to a binary.

Aamanen commented 6 years ago

Hello Thank you for your quick reply!

Im running on ubuntu 16.04 Yes however i try giving the path, it just returns the path as an error:

Error during launching of binary /opt/MUSIC-master/ros/adapters/ros_sensor_adapter MUSIC: No such file or directory

Could it be the environment of MUSIC that isn't linked correctly? Yes I didn't notice that the indentation disappeared when i copied it here - the file looks like the braitenberg3.music from the toolchains github.

The path "/opt/MUSIC-master/ros/adapters" is where the files "ros_sensor_adapter.cpp", "connect.cpp" etc are located. Where would you suspect them to be?

mdjurfeldt commented 6 years ago

Those are the source files which are compiled into a binary. After installation, I would expect the binary to end up at, for example, /usr/local/bin---if you didn't give your own ---prefix= to configure, i.e.

So, I think the first step here is to produce and install the binary ros_sensor_adapter. Once this is done and you have pointed to it correctly, I think your problem will then be gone.

weidel-p commented 6 years ago

@Aamanen did you install MUSIC with the flag --with-ros ? Otherwise the ros adapters are not compiled.

Anyway, may I also draw your attention to the new version of this software? Take a look at these two repositories: https://github.com/incf-music/music-adapters and https://github.com/incf-music/ros-music-adapters

Aamanen commented 6 years ago

@mdjurfeldt yes that really makes a lot more sense, and it also solved the problem!

@weidel-p I will look into those to repositories. Thank you!

Another question in the same topic: the ros_command_adapter only takes either a Twist message or a MultiArray, but I want to publish 2 torques to two jointcontrollers. Do you know if there is way to do this?

Aamanen commented 6 years ago

I also have another challenge with running the simulation: (sorry for the extreme formatting of the code :( )

martin@martin-X75VD:~/catkin_ws/src/ros_music_adapter-master/examples/braitenberg3$ mpirun -np 6 music fable.music initializing rate encoder initializing connect adapter initializing ROS sensor adapter initializing linear readout decoder initializing ROS command adapter [INFO] [2017.10.18 8:48:50 /opt/nest-2.12.0/nestkernel/rng_manager.cpp:226 @ Network::createrngs] : Creating default RNGs [INFO] [2017.10.18 8:48:50 /opt/nest-2.12.0/nestkernel/rng_manager.cpp:221 @ Network::createrngs] : Deleting existing random number generators [INFO] [2017.10.18 8:48:50 /opt/nest-2.12.0/nestkernel/rng_manager.cpp:226 @ Network::createrngs] : Creating default RNGs [INFO] [2017.10.18 8:48:50 /opt/nest-2.12.0/nestkernel/rng_manager.cpp:272 @ Network::creategrng] : Creating new default global RNG [martin-X75VD:20332] Process received signal [martin-X75VD:20332] Signal: Segmentation fault (11) [martin-X75VD:20332] Signal code: Address not mapped (1) [martin-X75VD:20332] Failing at address: 0xe9 [martin-X75VD:20332] [ 0] /lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7fbc4b976390] [martin-X75VD:20332] [ 1] /usr/local/lib/libmusic.so.1(_ZN5MUSIC7Runtime8finalizeEv+0x13)[0x7fbc4b6c79a3] [martin-X75VD:20332] [ 2] music(_ZN16RosSensorAdapter8finalizeEv+0xd)[0x412e9d] [martin-X75VD:20332] [ 3] music(_ZN16RosSensorAdapter9initMUSICEiPPc+0x5b6)[0x414546] [martin-X75VD:20332] [ 4] music(_ZN16RosSensorAdapter4initEiPPc+0xb9)[0x4146b9] [martin-X75VD:20332] [ 5] music(main+0x89)[0x4122c9] [martin-X75VD:20332] [ 6] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7fbc4a838830] [martin-X75VD:20332] [ 7] music(_start+0x29)[0x4123f9] [martin-X75VD:20332] End of error message ERROR: msg type unknown

mpirun noticed that process rank 0 with PID 20332 on node martin-X75VD exited on signal 11 (Segmentation fault).

weidel-p commented 6 years ago

@Aamanen regarding your first question of publishing two torques. There are multiple solutions to that. You could try to use two separate RosCommandAdapter, one for each torque. You could also publish both torques in one MultiArray and use a ROS script to separate them afterwards. Or you might want to extend the RosCommandAdapter by a message type that fits your needs.

To your SegementationFault issue, is this error occurring during or after the simulation? At this point I want to mention again that it might be worth the effort to switch to the new version of this software..

Aamanen commented 6 years ago

@weidel-p I was also considering duplicating the RosCommanAdapter, but I think the MultiArray and a ROS script to handle it would be more handy.

The segmentation fault happens after roslaunch of my robot (which is running fine), when I call the MPI mpirun -np 6 music fable.music And fable.music is more or less the file which i copied in, when i opened this issue

Aamanen commented 6 years ago

I will take your advice and spent the time to upgrade to the newest version!

Aamanen commented 6 years ago

After installing the two new adapter repositories I still have some troubles. My music configuration file, which i changed to use the new repos looks like this fablenew.txt (here in .txt format) But i still receive this

martin@martin-X75VD:~/catkin_ws/src/ros-music-adapters/examples/braitenberg3/scripts$ mpirun -np 6 music fablenew.music 
ROSContAdapter init 
ContContAdapter init 
RateEncoderAdapter init 
[INFO] [2017.10.18 14:19:28 /opt/nest-2.12.0/nestkernel/rng_manager.cpp:226 @ Network::create_rngs_] : Creating default RNGs
[INFO] [2017.10.18 14:19:28 /opt/nest-2.12.0/nestkernel/rng_manager.cpp:221 @ Network::create_rngs_] : Deleting existing random number generators
[INFO] [2017.10.18 14:19:28 /opt/nest-2.12.0/nestkernel/rng_manager.cpp:226 @ Network::create_rngs_] : Creating default RNGs
[INFO] [2017.10.18 14:19:28 /opt/nest-2.12.0/nestkernel/rng_manager.cpp:272 @ Network::create_grng_] : Creating new default global RNG
LinearDecoderAdapter init 
ContROSAdapter init 
[martin-X75VD:15779] *** Process received signal ***
[martin-X75VD:15779] Signal: Segmentation fault (11)
[martin-X75VD:15779] Signal code:  (128)
[martin-X75VD:15779] Failing at address: (nil)
[martin-X75VD:15779] [ 0] /lib/x86_64-linux-gnu/libc.so.6(+0x354b0)[0x7fadf63954b0]
[martin-X75VD:15779] [ 1] /usr/local/lib/libmusic.so.1(_ZN5MUSIC7Runtime8finalizeEv+0x13)[0x7fadf74409a3]
[martin-X75VD:15779] [ 2] /opt/MUSICADAPTER/lib/libmusicadapter.so(_ZN7Adapter8finalizeEv+0xd)[0x7fadf792b0bd]
[martin-X75VD:15779] [ 3] music(_ZN14ROSContAdapter4initEiPPc+0x9ee)[0x414b3e]
[martin-X75VD:15779] [ 4] music(main+0x2b)[0x413abb]
[martin-X75VD:15779] [ 5] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7fadf6380830]
[martin-X75VD:15779] [ 6] music(_start+0x29)[0x413b49]
[martin-X75VD:15779] *** End of error message ***
ERROR: msg type unknown
--------------------------------------------------------------------------
mpirun noticed that process rank 0 with PID 15779 on node martin-X75VD exited on signal 11 (Segmentation fault).

I can't really figure out what the messages means besides from the last "ERROR: msg type unknown" which is the Float64MultiArray type i try to write the commands to. Still I don't see how it doesn't take Float64MultiArray as a correct msg type, as MultiArray and Twist is the only ones implemented in the "cont_ros_adapter" from the repository

mdjurfeldt commented 6 years ago

Hi,

Unfortunately, I'm at a conference now and can't help you with detailed debugging. Maybe Philippe can help you? If problems persist next week, you could send me an archive with a failing example such that I can debug it.

The stack trace you see indicates that something goes wrong which one of the adapters finishes. This should not normally happen.

Best regards, Mikael

On Wed, Oct 18, 2017 at 2:54 PM, Aamanen notifications@github.com wrote:

After installing the two new adapter repositories I still have some troubles. My music configuration file, which i changed to use the new repos looks like this fablenew.txt https://github.com/INCF/MUSIC/files/1394637/fablenew.txt (here in .txt format) But i still receive this

martin@martin-X75VD:~/catkin_ws/src/ros-music-adapters/examples/braitenberg3/scripts$ mpirun -np 6 music fablenew.music ROSContAdapter init ContContAdapter init RateEncoderAdapter init [INFO] [2017.10.18 14:19:28 /opt/nest-2.12.0/nestkernel/rng_manager.cpp:226 @ Network::createrngs] : Creating default RNGs [INFO] [2017.10.18 14:19:28 /opt/nest-2.12.0/nestkernel/rng_manager.cpp:221 @ Network::createrngs] : Deleting existing random number generators [INFO] [2017.10.18 14:19:28 /opt/nest-2.12.0/nestkernel/rng_manager.cpp:226 @ Network::createrngs] : Creating default RNGs [INFO] [2017.10.18 14:19:28 /opt/nest-2.12.0/nestkernel/rng_manager.cpp:272 @ Network::creategrng] : Creating new default global RNG LinearDecoderAdapter init ContROSAdapter init [martin-X75VD:15779] Process received signal [martin-X75VD:15779] Signal: Segmentation fault (11) [martin-X75VD:15779] Signal code: (128) [martin-X75VD:15779] Failing at address: (nil) [martin-X75VD:15779] [ 0] /lib/x86_64-linux-gnu/libc.so.6(+0x354b0)[0x7fadf63954b0] [martin-X75VD:15779] [ 1] /usr/local/lib/libmusic.so.1(_ZN5MUSIC7Runtime8finalizeEv+0x13)[0x7fadf74409a3] [martin-X75VD:15779] [ 2] /opt/MUSICADAPTER/lib/libmusicadapter.so(_ZN7Adapter8finalizeEv+0xd)[0x7fadf792b0bd] [martin-X75VD:15779] [ 3] music(_ZN14ROSContAdapter4initEiPPc+0x9ee)[0x414b3e] [martin-X75VD:15779] [ 4] music(main+0x2b)[0x413abb] [martin-X75VD:15779] [ 5] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7fadf6380830] [martin-X75VD:15779] [ 6] music(_start+0x29)[0x413b49] [martin-X75VD:15779] End of error message ERROR: msg type unknown

mpirun noticed that process rank 0 with PID 15779 on node martin-X75VD exited on signal 11 (Segmentation fault).

I can't really figure out what the messages means besides from the last "ERROR: msg type unknown" which is the Float64MultiArray type i try to write the commands to. Still I don't see how it doesn't take Float64MultiArray as a correct msg type, as MultiArray and Twist is the only ones implemented in the "cont_ros_adapter" from the repository

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/INCF/MUSIC/issues/42#issuecomment-337580859, or mute the thread https://github.com/notifications/unsubscribe-auth/ADcfCQHSAPRQatTjuo4kINyVdPb43t4zks5stfUhgaJpZM4P7_P1 .

Aamanen commented 6 years ago

@mdjurfeldt okay thank you! I will try solving it in the meantime, and hopefully I will have it solved before next week :)

weidel-p commented 6 years ago

@Aamanen there was a mistake in the naming of the message types. The ros_cont_adapter expected you to call the Float64MultiArray just FloatArray. This is of course not consistent with the ROS message types, so I changed it. Please pull the newest update and reinstall, then this error shouldn't occur anymore.

Thanks for the bug report!

Aamanen commented 6 years ago

Wow I've been staring blindly at that line of code so many times and not noticing that... Thank you so much @weidel-p ! Simulation runs smoothly now

mdjurfeldt commented 6 years ago

Good to hear!

Closing this issue.