ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

roslisp/rosprolog General Questions [closed]

asked 2016-01-07 10:27:13 -0600

toddcpierce gravatar image

Hey Everybody,

Is anybody using roslisp to talk to rosprolog? Specifically, I was hoping to access swi-prolog (running rosprolog) running on one PC from sbcl lisp (running roslisp) running on another PC. The idea behind this is to have one machine (prolog/knowrob) dedicated to loading owl files and doing all the reasoning on behalf of the main (lisp) machine that does the more general processing based on the results of that reasoning.

I am not having any luck finding any examples and documentation of this exact configuration, though I figured it would be the most obvious one. Does ROS even support these two running on different machines at all? If so, how is the communication happening? Is the json-prolog call somehow using the normal service and messaging infrastructure of ROS or is it something different? Should I just have a swank client running local to the prolog?

Does anybody have any good general tips/wisdom they've come across with this configuration?

Thanks in advance.

-Todd

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by toddcpierce
close date 2016-02-16 12:09:02.469216

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-01-07 12:25:02 -0600

gaya gravatar image

Hi Todd,

In CRAM (a Common Lisp robot programming framework) we are using json_prolog to talk from SBCL to SWI Prolog.

Is the json-prolog call somehow using the normal service and messaging infrastructure of ROS or is it something different?

It is based on the ROS service mechanism, for your case of querying rosprolog from Lisp, json-prolog would help you register a rosprolog ROS service that can answer queries over ROS and send the results back to Lisp. The query and the result are encoded in JSON format. Nothing fancy.

Does ROS even support these two running on different machines at all?

Not sure if I understood your question correctly but if you're asking if you can run a ROS service server on one machine and query it from another machine, yes, sure, just make sure you set up your $ROS_MASTER_URI (and eventually $ROS_IP) entries right.

Should I just have a swank client running local to the prolog?

On the Lisp side we have a cram_json_prolog package which contains a number of utility functions to call the service using the persistent service API, take a look here: https://github.com/cram2/cram_json_pr... . We use lazy lists to represent the result of the Prolog query as it can have an infinite length, so this package has a dependency on two small CRAM packages from the cram_core repository, which implement lazy lists for Common Lisp etc..

You would then call the service from Lisp like this:

   (json-prolog:prolog
    `(and ("some_swi_predicate" "some_known_binding_as_string" ?some_resulting_binding)
          ("other_swi_prolog_predicate" 123 ?another_resulting_binding)))

and the variables ?some_resulting_binding and ?another_resulting_binding will have the values that you are interested in in your query.

Unfortunately, I cannot point you to any self-contained documentation about `json_prolog, as the packages are themselves not self-contained and depend on other parts of our systems. If you like the approach and would like to know more feel free to edit your question / comment or drop me an email at gaya [at] cs [dot] uni-bremen [dot] de or open an issue on the corresponding Github repo.

edit flag offensive delete link more

Comments

Gaya,

Perfect! It looks like everything is implemented exactly as I hoped it would be!

When I set all of this up I will probably have a couple of questions remaining. I will document everything at that time so that it at least exists somewhere.

Thanks for the help,

-Todd

toddcpierce gravatar image toddcpierce  ( 2016-01-07 13:28:23 -0600 )edit

Glad to hear the answer from @gaya was helpful! Note that if the answer fully answers your question, it is good practice to accept the answer by clicking the check box under the up/downvote arrows. Also, please don't provide answers that are not answers... this post should likely be a comment.

jarvisschultz gravatar image jarvisschultz  ( 2016-01-07 13:58:44 -0600 )edit

@toddcpierce I just moved your answer to a comment.

jarvisschultz gravatar image jarvisschultz  ( 2016-01-07 13:59:27 -0600 )edit

Question Tools

Stats

Asked: 2016-01-07 10:27:13 -0600

Seen: 371 times

Last updated: Jan 07 '16