0
$\begingroup$

Rosanswers logo

Trying to load a library of functions from a ROS package's init.pl file, json_prolog gives the error:

ERROR: /home/path/my_package/prolog/init.pl:19:
 source_sink `library(my_lib)' does not exist 
Warning: /home/path/my_package/prolog/init.pl:19:
 Goal (directive) failed: user:use_module(library(my_lib))

The init.pl file uses the code

:- use_module(library('my_lib')).

to load a file 'my_lib.pl' located in the same directory as init.pl.

When starting the package using rosrun rosprolog rosprolog my_package the module gets compiled and loaded fine.

I suspect the problem is that JSONPrologNode.java uses ensure_loaded('/home/path/my_package/prolog/init.pl') instead of register_ros_package(my_package) which is what rosprolog uses.


Originally posted by zsaigol on ROS Answers with karma: 225 on 2013-08-22

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Normally, the register_ros_package(my_package) statement should be in that package's init.pl to make sure that the package's path is added to Prolog's library search path.


Originally posted by moritz with karma: 2673 on 2013-08-22

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by zsaigol on 2013-08-23:
Thanks Moritz, that works fine! Although it does seem a bit inconsistent that "rosrun rosprolog rosprolog my_package" and "rosrun json_prolog json_prolog _initial_package:=my_package" work differently.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.