0

I have a script that uses np.loadtext to populate a numpy array. This process is only done on init and basically acts like a look up table from there on.

I want to implement this in Ros Kinetic. I have created a ROS node that performs the task and now I am wondering what is the best way to populate this array on init? Is there an analog to np.loadtext I can use? Do I need to convert it to something like a roslaunch xml or rosbag. I'm relatively new to ROS so not so familiar with parameter server etc.

I'd like to be able to change the files every now and then for different test scenarios and have the values picked up on init and the file is fairly large ~7Mb.

Thanks in advance.

  • Just because it is a ROS node does not mean you cannot use numpy anymore. Just use `np.loadtext` as you did before. You can use a ROS parameter to pass the filename, though. See [ROS wiki page about parameters in Python](http://wiki.ros.org/rospy/Overview/Parameter%20Server). – luator Apr 27 '18 at 14:27
  • Thanks, like I said I am relatively new to ROS. Was getting some build errors when I tried to use it but it turned out to be a separate issue. Thanks for the tip regarding the filename. – Bryanmc650 Apr 30 '18 at 10:39

0 Answers0