This is an old revision of the document!


Marker-based visualization canvas

Based on rviz Markers, this visualization module can display the current or past belief states in the rviz visualizer as well as in the ros3djs web-based visualization.

An example can be seen here (only from the local network): http://tenorth.ai.loc/~tenorth/test-vis.html

This module is currently under development and not publicly available.

System overview

Note: Though the visualization looks much like a standard web page, it's more similar to a web-based rviz. This means that there is still a single ROS graph and a single KnowRob instance in the background that is shared among all website visitors.

Installation

Setting up your computer as server for the web-based marker visualization involves a few steps to make everything work properly:

  • Install a web server, e.g. apache2 by sudo apt-get install apache2
  • Set up the system to serve web pages from ~/public_html to http://localhost/~username
  • Put the contents of the 'html' folder in knowrob_marker_vis into the ~/public_html folder. This is needed since some browsers don't accept loading Javascript and HTML files partly from the web and partly from your local harddisk for security reasons. You therefore always have to use the HTML file served by your web browser.
  • To use CAD models for visualization, put the respective ROS packages into your global web root, usually /var/www. The package://xyz URLs describing the models are mapped to http://localhost/xyz. The pr2_description, for example, should be put into /var/www/pr2_description.

Example queries

The following queries read data from the semantic map and from the logged data and visualize it in the browser-based visualization. The robot pose at time 1377780296 is read from the MongoDB using the tfMemory extension.

$ roslaunch knowrob_vis knowrob_vis.launch
$ rosrun rosprolog  rosprolog knowrob_vis

% load packages, start marker publisher
?- register_ros_package(knowrob_mongo), register_ros_package(mod_srdl), visualisation_canvas.

% load and visualize semantic map
?- owl_individual_of(A, knowrob:'SemanticEnvironmentMap'), add_object_with_children(A).

% read robot pose at time 1377766521 from MongoDB
?- mng_robot_pose_at_time(pr2:'PR2Robot1', '/map', knowrob:timepoint_1377780296, Pose).

% add robot to the visualization
?- add_object_with_children(pr2:'PR2Robot1', knowrob:timepoint_1377780296).

% highlight all cameras that are part of the SRDL model of the robot
?- owl_individual_of(A, srdl2comp:'Camera'), highlight_object(A, @(true), 0, 255, 255, 255).

The following is to be performed from the roslog_2013_08_29_1445 folder:

# Is some part of the right arm blocking the view on the object?
?- register_ros_package(mod_srdl), owl_parse('perceive-no-details.owl', false, false, true).
?- mng_obj_pose_by_desig('http://ias.cs.tum.edu/kb/cram_log.owl#VisualPerception_Z9fXhEae_object_0', Pose).
?- sub_component(pr2:pr2_right_arm, Part), 
   once(owl_individual_of(Part, srdl2comp:'UrdfLink')),
   obj_blocked_by_in_camera(log:'VisualPerception_Z9fXhEae_object_0', Part, 
   pr2:pr2_head_mount_kinect_rgb_link, log:'timepoint_1377780296').
   
# Is the object visible in the camera, given the camera's field of view?
?- obj_visible_in_camera(log:'VisualPerception_Z9fXhEae_object_0', 
                         pr2:pr2_head_mount_kinect_rgb_link,   
                         log:'timepoint_1377780219').
false.

?- obj_visible_in_camera(log:'VisualPerception_Z9fXhEae_object_0', 
                         pr2:pr2_head_mount_kinect_rgb_link,
                         log:'timepoint_1377780271').
true .