User Tools

Site Tools


software:openease_robot_interface_gsoc

Logging using predicates that are in knowrob_cram/knowrob_cram.pl

It is suggested before starting that take a look at predicates in knowrob_cram.pl. If you have questions regarding the usage of predicates, contact me (asil@cs.uni-bremen.de)

JSONProlog based solution (without openEASE in the loop)

1) In order to be able to import the asserted log events to an owl file with ease, you will need to use Asil's fork of knowrob_addons in “devel” branch. The changes will be merged with main branch soon

2) Start your roscore and json_prolog service.

3) Register predicates in knowrob_cram package w/ prolog query: register_ros_package('knowrob_cram').

4) You can ready to assert some logging inside

  Some example queries: 
       %Starts an task with type CRAMAction and context DummyContext at time 1492785072
       %Since Parent Task parameter (PA) is unbound, there will be no parent task of this action
       cram_start_action(knowrob:'CRAMAction', 'DummyContext', 1492785072, PA, ActionInst).
       %Task name will be returned in variable ActionInst.
       
       %Finish the task that previous query started. 
       cram_finish_action(knowrob:'CRAMAction_SAPQB1', 1492785075). 
       % knowrob:'CRAMAction_SAPQB1' is returned in ActionInst at previous query
       
       %Export to owl. 
       rdf_save('/home/asil/test.owl', [graph('LoggingGraph')]). 

openEASE based solution (connecting openEASE from your JSONProlog service) In order to use this feature, you will need to use Asil's fork of knowrob_addons in “devel” branch. The changes will be merged with main branch soon

It is suggested before starting that take a look at predicates in knowrob_cloud_logger/knowrob_cloud_logger.pl. If you have questions regarding the usage of predicates, contact me (asil@cs.uni-bremen.de)

The latest changes in openEASE are not pushed in the erface connected“ “Container started.” main seerver yet. You can use local openEASE instance at 192.168.100.219 for now.

a) Creating API token and saving certificate of openEASE

0) Browse to https://192.168.100.219 careful not starting with http: ;) and make a security exception for self-signed certificate

1) Using registration pane, create a user account for yourself from openease web interface.

2) Log in with your crediantial and, then, go to Tools/User Details from Menu.

3) Create an API token by clicking ”(create new)“

4) Save this token in somewhere safe since this is your personel token that will authenticate you for openEASE from jsonprolog service

5) After creation of api token, now it is time to save the certificate… Click lock symbol next to address symbol in Firefox. Then click to arrow ”>“.

6) You will see a popup window.. Click to “View Certificate” from this popup.

7) Switch to Details tab. Finally, click export in order to save the certificate to your local drive in crt format.

8) Open a terminal and export the certificate to pem format with following command:

      
      openssl x509 -in mycert.crt -out mycert.pem -outform PEM

b) Using API token and saved certificate, connecting to openEASE from json_prolog

1) Start your roscore and json_prolog service.

2) Register predicates in knowrob_cloud_logger package w/ prolog query: register_ros_package('knowrob_cloud_logger').

3) Authenticate yourself and start your user container

       % Connection and Authentication to server 
       cloud_interface('https://192.168.100.219','/home/asil/localhost.crt.pem','PrivateAPIToken').
       
       % Start your user container on the server side 
       start_user_container.
       % Connect to the user container
       connect_to_user_container.

4) Sending queries:

      
       % Send query. ID variable will return the id of the query assigned by openease. 
       % This id will be used for getting next solution 
       send_prolog_query('cram_start_action(knowrob:\'CRAMAction\', \'DummyContext\', 1492785072, PA, ActionInst)', @(false), Id).
                
       % Get the solution to buffer
       send_next_solution('fa04359f-e0bf-4540-941c-3cae79e6eb89').
       
       % Reach the registered solution 
       read_next_prolog_query(Result).
      

5) Saving asserted facts (the path for owl file should be in /home/ros/user_data where user has write access):

       % Send query. ID variable will return the id of the query assigned by openease. 
       % This id will be used for getting next solution 
       send_prolog_query('rdf_save(\'/home/ros/user_data/test.owl\', [graph(\'LoggingGraph\')]).', @(false), Id).
                
       % Get the solution to buffer
       send_next_solution('fa04359f-e0bf-4540-941c-3cae79e6eb89').

6) Reaching the owl file: Go to openEASE web interface that you made logging (in our case: https://192.168.100.219) and log-in with your credentials. Then, navigate to “view-source:192.168.100.219/user_data/[YourEpisodicMemoryName].owl” from Firefox address bar. Finally, right click to the source file and saving it will let you keep the episodic memory in your local drive

Troubleshooting

Q: I get an error

   javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative names present
      at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
      at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1959)
      at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302)
      at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296)
      at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1514)
      at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)
      at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1026)
      at sun.security.ssl.Handshaker.process_record(Handshaker.java:961)
      at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1072)
      at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385)
      at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413)
      at jpl.Query.hasMoreSolutions(Query.java:258)
      at jpl.Query.allSolutions(Query.java:556)
      at org.knowrob.json_prolog.query.AllSolutionsCommand.execute(AllSolutionsCommand.java:6)
      at org.knowrob.json_prolog.query.ThreadedQuery.run(ThreadedQuery.java:140)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)
    Caused by: java.security.cert.CertificateException: No subject alternative names present
      at sun.security.util.HostnameChecker.matchIP(HostnameChecker.java:145)
      at sun.security.util.HostnameChecker.match(HostnameChecker.java:94)
      at sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:455)
      at sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:436)
      at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:200)
      at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124)
      at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1496)
      ... 26 more
   java.lang.Exception: jpl.PrologException: PrologException: 
   error(java_exception(@('J#00000139763201972864')), 'org.openease.client.EASEError')
      at org.knowrob.json_prolog.JSONPrologNode$NextSolutionCallback.build(JSONPrologNode.java:308)
      at org.knowrob.json_prolog.JSONPrologNode$NextSolutionCallback.build(JSONPrologNode.java:272)
      at 
   org.ros.internal.node.service.ServiceRequestHandler.handleRequest(ServiceRequestHandler.java:65)
      at org.ros.internal.node.service.ServiceRequestHandler.access$100(ServiceRequestHandler.java:38)
      at org.ros.internal.node.service.ServiceRequestHandler$1.run(ServiceRequestHandler.java:99)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)
   Caused by: jpl.PrologException: PrologException: error(java_exception(@('J#00000139763201972864')), 
 'org.openease.client.EASEError')
      at jpl.Query.get1(Query.java:336)
      at jpl.Query.hasMoreSolutions(Query.java:258)
      at jpl.Query.allSolutions(Query.java:556)
      at org.knowrob.json_prolog.query.AllSolutionsCommand.execute(AllSolutionsCommand.java:6)
      at org.knowrob.json_prolog.query.ThreadedQuery.run(ThreadedQuery.java:140)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      ... 3 more

Make sure the certificate has the correct expiration date and your correct IP (not just localhost).

software/openease_robot_interface_gsoc.txt · Last modified: 2018/06/08 11:51 by gkazhoya

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki