Sign inSign up

h2020infuse/morse-simu-prod

By h2020infuse

•Updated about 8 years ago

Docker images for producing simulated ASN.1 data and testing DFNs in simulation

Image
0

1.8K

h2020infuse/morse-simu-prod repository overview

⁠General description

Simulation makes it easy to produce asn1 data and to test DFNs. Two docker images have been made available for that purpose.

⁠Prerequisites

⁠h2020infuse/morse-simu-prod

A docker image (based on ubuntu 16.04) containing:

A rover is simulated using MORSE. Each rover's sensor (stereobench, pose...) publishes its data to a corresponding ROS topic using standard ROS messages.

A conversion module transforms these standard ROS messages into InFuse ASN.1 types. The module outputs their serialized form as an asn1bitstream ROS message on a new topic and also on a YARP port. The asn1bitstream message is a custom ROS message that needs to be known by ROS (it is done by default in this docker).

Once the simulator and converter are running, you can subscribe to the converter topic (or connect to its YARP ports) to get the serialized data, and then decode it. At Magellium, we have a mechanism that allows to encapsulate a DFN in a YARP module(without modifying it) to make its input/output available through YARP ports.

⁠h2020infuse/yarpmonitor-ubuntu-prod

A docker image (based on ubuntu 16.04) containing:

YarpHelper is a framework built on top of YARP with the goal of facilitating its use and extending its functionalities in the context of robotics. Among the functions provided by YarpHelper can be found:

  • Sensor acquisition and control modules (RGB Cameras, Kinect, ToF Camera, IMUs, GPS, Altimeter, Rangefinder, Lidar, etc.)
  • Data sensor logging and replay modules
  • Data visualization modules (Image viewer, point cloud viewer, etc.)
  • Your own algorithms (even DFNs)

It can also be used to create, deploy and monitor any type of data processing chains using various sensors, multiple computing nodes and mixed processor architectures. In our context, YarpMonitor allows to control the YarpHelper modules present in the h2020infuse/morse-simu-prod image. For now, these modules have been shared as binaries.

⁠Usage

⁠STEP 1: Launch a yarpmonitor container

Pull the docker image: docker pull h2020infuse/yarpmonitor-ubuntu-prod:latest Save the following code as a bash script and give it execution permissions.

#!/bin/bash
dockerimage="h2020infuse/yarpmonitor-ubuntu-prod:latest"
dockercontainer="yarpmonitor-standalone"

# Stop yarpmonitor-standalone if already running
docker stop ${dockercontainer}
docker rm ${dockercontainer}

# Get host IP (required for running yarpserver)
HOSTIP=`ip route get 8.8.8.8 | head -1 | cut -d' ' -f8`
export YARP_SERVER="$HOSTIP 10000"

# Run a yarpmonitor container
docker run --restart=unless-stopped -d --privileged -e DISPLAY --net=host --env YARP_SERVER --net=host --name ${dockercontainer} -e ROS_MASTER_URI -e SPLASH_SCREEN="splash_infuse" ${dockerimage} 
echo "Working with $YARP_SERVER"

Run this script to start a container named yarpmonitor-standalone. YarpMonitor should now be available from here http://localhost:3000/#⁠

⁠STEP 2: Run a morse-simu-prod container

Pull the docker image: docker pull h2020infuse/morse-simu-prod:latest Save the following code as a bash script and give it execution permissions.

#!/bin/bash
dockerimage="h2020infuse/morse-simu-prod:latest"
dockercontainer="morse-simu-prod"

# Stop yarpmonitor-standalone if already running
docker stop ${dockercontainer}
docker rm ${dockercontainer}

# Get host IP (required for connecting to yarpserver)
HOSTIP=`ip route get 8.8.8.8 | head -1 | cut -d' ' -f8`
export YARP_SERVER="$HOSTIP 10000"
xhost +

# Run a morse-simu-prod container
nvidia-docker run --restart=unless-stopped -d --env YARP_SERVER --privileged -e DISPLAY --name ${dockercontainer}  --net=host -e ROS_MASTER_URI ${dockerimage}

Run this script to start a morse-simu-prod container.

⁠STEP 3: Launch the simulation or the PEL recordings

a) Launching the simulation

From YarpMonitor⁠, under the Yarp Apps tab, search for "InFuseSimu.xml" and click on the link to launch the simulation chain. This chain launches roscore + MORSE + Ros2YarpAsnConverter + ImageSynchronizer within the morse-simu-prod container we launched earlier.

Ros2YarpAsnConverter is a YarpHelper module that subscribes to MORSE topics (1 topic per sensor), converts and serializes the messages, to finally sends them back through:

  • ROS topics (/RobotPose, /caml2base, /camr2base, /ImageL, /ImageR)
  • and yarp ports

The ImageSynchronizer module connects to Ros2YarpAsnConverter output ports to synchronize the left and right ImageStamped_InFuse, and produces an ImagePair_InFuse. This ImagePair_InFuse is sent through a YARP port and also in a /img_stereo ROS topic.

b) Replaying PEL recordings

From YarpMonitor⁠, under the Yarp Apps tab, search for "BB2Converter.xml" and click on the link to launch the convertion chain. This chain launches roscore + BB2Converter + ImageSynchronizer within the morse-simu-prod container we launched earlier.

BB2Converter works exactly like Ros2YarpAsnConverter (it only subscribes to BB2 topics instead of Morse ones).

Once the chain is launched, you can play any PEL rosbag from your computer using rosbag play path/to/rosbag.bag.
Make sure that ROS_MASTER_URI is set to http://localhost:11311/⁠.

⁠STEP 4: Connect your DFN to the converter and synchronizer outputs

You can connect your DFN to the converter and synchronizer outputs by:

a) Subscribing to one of its topics.

The message type is a custom ROS message named asn1_bitstream.msg defined as follow:

# Common header
std_msgs/Header header
# Identification of the type : ASN.1 name
string type
# Serialisation method : 0 (uPER), 1 (BER), 2 (XER)
uint8 serialization_method
# Buffer with serialised data
uint8[] data

The data field contains the serialized data. You will have to call the corresponding asn1 type decode function to deserialize this data.

b) Using YarpHelper DFN encapsulation to make the DFN inputs/outputs accessible from YarpMonitor.

The DFN will appear as a module like Ros2YarpAsnConverter, and you will be able to drag a line from a port to another to establish a connection. This mechanism not only makes it easy to connect a DFN to the converter but also makes it easy to build chains of DFNs. It is available in the CDFF feature/yarp_middleware_support branch in the folder MiddlewareSupport.

⁠Tips and tricks

  • Some viewers are available in YarpMonitor as WebApps. Type "asn" under the WebApps tab to display them. /ImageViewer-Simple-mono-asn1.yarp.html can be use to display mono images for exemple.
  • Hit [h] in the Morse/Blender window to display shortcuts.
  • The rover can be moved by publishing standard twist messages to the /Minnie/motion_controller topic.
  • The simulation can be modified by editing/replacing the scenario.py file in the /simulation folder of the morse-simu-prod and/or the scene.blend. You can also make a copy of /simulation locally, modify it and mount it to /simulation.
  • To access a yarp module parameters, double click on the module. A panel should appear on the left in YarpMonitor.
  • The pre-cited panel allows to control the state of the module (start, pause, shutdown...)
  • To shutdown all the modules at once, just click on shutdown button in the top bar. Blender has to be closed manually by hitting [esc].

⁠Troubleshooting

  • Web viewers do not display anything => Connect the viewer only when data is being published.
  • If the monitor freezes and becomes unresponsive => Relaunch the script of the step1 (note that the processing chain will remain active, only the monitor will restart)
  • If the rosbag ends, relaunch the whole chain. The converter which is using tf won't be able to find transform in the past.

Tag summary

Content type

Image

Digest

Size

2.2 GB

Last updated

about 8 years ago

docker pull h2020infuse/morse-simu-prod