Docker images for producing simulated ASN.1 data and testing DFNs in simulation
1.8K
Simulation makes it easy to produce asn1 data and to test DFNs. Two docker images have been made available for that purpose.
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.
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:
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.
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/#
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.
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:
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/.
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.
Content type
Image
Digest
Size
2.2 GB
Last updated
about 8 years ago
docker pull h2020infuse/morse-simu-prod