[SOLVED] Plotting tool for synapses weights


#1

Dear NRP,

Is it possible to use the plotting tool to plot the weight of the synapses?
In the documentation I didn’t find any information about this, and the plotting tool shows only the robot position and the time. Is there any way to add a different data source?
Thank you.

Best Regards,
Simone.


#2

Dear Simone,

The plotting tool can plot any input coming over a ROS topic. Weights are not transmitted back to the frontend in any ROS topic unfortunately.
You have 2 solutions:

  • either you hack the code and create a ROS topic that feeds your weights to the frontend (non trivial)

  • or you don’t use plotting tools but plot to an image from within your transfer functions (called server-side plotting). This works nicely and you can plot whatever you want. Just import matplotlib or PIL (for example) and create your plotting utilities either in a file you push to the “Resources” pane, or directly in your transfer function and use in your transfer functions.
    An excellent example of this can be found in the transfer function benchmark_evaluation.py from the benchmark_3pdx (aka “Benchmark Pioneer P3DX experiment”). To find this file, clone this experiment and click on its “Files” button, then download it.

You will see that this transfer function creates a ROS topic of type Image:

 @nrp.MapRobotPublisher('benchmark_metrics', Topic('/benchmark/metrics', sensor_msgs.msg.Image))

And the

def getImageWithMetrics(self):

function imports PIL and plots into an image which is written to this topic.

In the end, just opening the image viewer in the frontend will show you the live plotting.
Hope this helps,

Axel


#3

Dear Simone,

Did my answer help? Could you plot your weights?

Best regards
Axel


#4

Dear Axel,

Sorry for the delay.
Your answer was very useful, in particular I seen the example that you suggested me and helped me a lot.

Thank you for the help.
Best Regards,

Simone.