Ask Your Question
0

What's difference between rosrun and register_ros_package?

asked 2012-08-06 04:00:04 -0500

sam gravatar image

updated 2012-08-06 22:20:41 -0500

I followed knowrob tutorials KnowRob basics and Computables.

The way to use rosrun is:

  rosrun rosprolog rosprolog mod_vis
  ?- register_ros_package(ias_semantic_map).

The way to use register_ros_package:

  rosrun rosprolog rosprolog ias_semantic_map

I know the second way can use something like this

  rdf_triple(knowrob:'on-Physical', Top, Bottom).

But what's the major difference idea between them?

Thank you~


I run:

  sam@sam:~/code/ros/test$ rosrun rosprolog rosprolog ias_semantic_map
  % library(swi_hooks) compiled into pce_swi_hooks 0.00 sec, 3,616 bytes
  %     library(error) compiled into error 0.00 sec, 17,688 bytes
  %    library(lists) compiled into lists 0.00 sec, 41,424 bytes
  %   library(shlib) compiled into shlib 0.00 sec, 62,200 bytes
  %   library(option) compiled into swi_option 0.01 sec, 15,080 bytes
  %  library(process) compiled into process 0.01 sec, 93,400 bytes
  % /opt/ros/electric/stacks/knowrob/rosprolog/prolog/init.pl compiled 0.01 sec, 100,848 bytes
  %     library(jpl) compiled into jpl 0.01 sec, 285,496 bytes
  %         library(sgml) compiled into sgml 0.00 sec, 38,464 bytes
  %           library(quintus) compiled into quintus 0.00 sec, 21,384 bytes
  %          rewrite compiled into rewrite 0.00 sec, 34,768 bytes
  %          library(uri) compiled into uri 0.01 sec, 10,880 bytes
  %          library(record) compiled into record 0.00 sec, 31,072 bytes
  %         rdf_parser compiled into rdf_parser 0.01 sec, 161,832 bytes
  %          library(gensym) compiled into gensym 0.00 sec, 4,432 bytes
  %         rdf_triple compiled into rdf_triple 0.00 sec, 37,192 bytes
  %        library(rdf) compiled into rdf 0.01 sec, 271,360 bytes
  %         library(debug) compiled into prolog_debug 0.00 sec, 21,320 bytes
  %         library(assoc) compiled into assoc 0.01 sec, 22,640 bytes
  %        library(sgml_write) compiled into sgml_write 0.01 sec, 105,272 bytes
  %        library(nb_set) compiled into nb_set 0.00 sec, 5,968 bytes
  %         library(utf8) compiled into utf8 0.00 sec, 14,112 bytes
  %        library(url) compiled into url 0.00 sec, 113,584 bytes
  %        rdf_cache compiled into rdf_cache 0.01 sec, 15,904 bytes
  %       library(semweb/rdf_db) compiled into rdf_db 0.03 sec, 681,176 bytes
  %      comp_similarity compiled into comp_similarity 0.03 sec, 708,664 bytes
  %     /opt/ros/electric/stacks/knowrob/ias_prolog_addons/prolog/init.pl compiled 0.03 sec, 709,544 bytes
  %      library(broadcast) compiled into broadcast 0.00 sec, 7,344 bytes
  %     library(semweb/rdf_edit) compiled into rdf_edit 0.01 sec, 86,744 bytes
  %     library(semweb/rdfs) compiled into rdfs 0.00 sec, 25,992 bytes
  %     library(semweb/owl) compiled into t20_owl 0.01 sec, 68,496 bytes
  %       library(socket) compiled into socket 0.00 sec, 10,232 bytes
  %       library(base64) compiled into base64 0.00 sec, 17,400 bytes
  %      library(http/http_open.pl) compiled into http_open 0.00 sec, 77,136 bytes
  %     library(thea/owl_parser) compiled into owl_parser 0.01 sec, 156,080 bytes
  %      library(odbc) compiled into odbc 0.00 sec, 37,344 bytes
  %     library(semweb/rdfs_computable) compiled into rdfs_computable 0.01 sec, 87,536 bytes
  %    /opt/ros/electric/stacks/knowrob/semweb/prolog/init.pl compiled 0.10 sec, 1 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-08-06 04:09:31 -0500

moritz gravatar image

Both methods add the project directory to Prolog's library search path and load the prolog/init.pl file inside the respective package.

rosrun is a shell command that you call from e.g. your Bash shell. It starts Prolog and initially loads the init.pl of the package you give as argument, which then recursively loads all init.pl of all dependencies.

Once you have started a Prolog shell, you can use register_ros_package (which is a Prolog predicate, no shell/bash command) to load additional packages.

In the examples you gave, mod_vis and ias_semantic_map are independent of each other (none of them depends on the other). You therefore can't load both with a single command but have to load one first and then the other.

edit flag offensive delete link more

Comments

If two way both can load ias_semantic_map, why the way which use rosrun couldn't run visualisation_canvas? I have edited on the orginal post. Thank you~

sam gravatar image sam  ( 2012-08-06 22:22:04 -0500 )edit

You either need to use $ rosrun rosprolog rosprolog mod_vis ?- register_ros_package(ias_semantic_map). or $ rosrun rosprolog rosprolog ias_semantic_map ?- register_ros_package(mod_vis).

moritz gravatar image moritz  ( 2012-08-06 22:26:51 -0500 )edit

You can check with rospack, neither package depends on the other one, so neither will be initialized if you launch KnowRob with the other one as argument. You need to load the package you haven't use as argument to rosprolog manually using register_ros_package.

moritz gravatar image moritz  ( 2012-08-06 22:29:08 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-08-06 04:00:04 -0500

Seen: 298 times

Last updated: Aug 06 '12