Please note: this tutorial is for use with the SmartMDSD Toolchain v2 (and according virtual machine)
With Gazebo another powerful and state of the art robotics simulator is ready to use with SmartSoft. In the same way as MORSE, RobtinoSim, player and others simulators, Gazebo can be used very easy with SmartSoft without requiring other complicated infrastructure (e.g. no ROS required). With Gazebo accessible within the SmartSoft ecosystem, it is now possible to reuse many other existing SmartSoft components in collaboration with Gazebo. The SmartSoft principles, the component model and the SmartMDSD Toolchain are ready to use for robotics software development using the Gazebo simulator.
SmartSoft is interacting with the Gazebo simulator in the same way it is interacting with other simulators. One or many SmartSoft components wrap the interface to Gazebo and over the messages to control the robots and to provide the sensor messages at a service level to the other SmartSoft components. The following figure illustrates the usage of Gazebo, or other simulators (RobotionSim, MORSE, etc.) and the transparent replacement of real hardware with simulation at a level of software services, within SmartSoft:
An example component how to interface a robot (differential drive, equipped with a laser ranger) simulated in Gazebo, is the SmartGazeboBaseServer. The component illustrates how the Gazebo simulator can be used with in the SmartSoft ecosystem through components. The SmartGazeboBaseServer component receives from and sends messages to gazebo containing the robots odometry, the laser scans and the commanded velocity, and offers those information to other SmartSoft components via its services. Other sensors or actuators can easily be added in a similar component, using the SmartGazeboBaseServer as a blueprint.
SmartGazeboBaseServer is released under LGPL and can be downloaded from sourceforge.
Please note: this step-by-step guide is for use with the SmartMDSD Toolchain v2 (and according virtual machine) for use with ACE/SmartSoft in 2017. The general principle described here still applies. This page is no longer maintained, but kept for documentation purposes. For the current version, refer to tutorials, that also feature the Gazebo simulator
To provide a quick and easy entry into SmartSoft and Gazebo simulation, the most recent version of the SmartSoft VM contains an installed gazebo simulator. A modelled deployment can be started using the SmartMDSD Toolchain within this virtual machine. The deployment realizes a simple navigation scenario, where the Tiago robot (PAL Robotics) navigates within a simulated flat either autonomously or steered by a joystick. To try things out within the VM, just follow the next few steps. If you want to run the scenario natively on your computer a quick install guide is appended.
Note: The VM uses VirtualBox and is tested to work with versions 5.0 and 5.1, no guest additions installed (not working with guest additions). The performance is not particularly high, but ok for testing.
1. Start Simulator:
Start Gazebo befor starting the SmartSoft Deployment:
2. With the SmartMDSD Toolchain, select the SmartSoft Deplayment Project: DeployTiagoNavigation and start the deployment:
Deploy and Start the Depolyment by right-clicking on DeployTiagoNavigation in the Project Explorer and select Deploy+ Run SmartMDSD Deployment.
Once the files have been deployed (local directory within the VM), a dialogue will pop up and ask whether you want to start the deployment, select yes.
3. Start the deployed scenario:
The following scenario control menu will open, select menu-start.
The scenario starts and a few terminals will open, each for every started component.
In the window SmartLispServer (sequencer) press 0 to start the navigation scenario: 4. Select what to do:
- Now you can either:
Press 3 to drive Tiago with a joystick (assuming a joystick is connected!)
Press 5 to select a goal location:
The robot will then drive to the selected goal location (see figure below). After the goal is reached, the menu will appear again.
What is needed to run the example of the SmartSoft-Gazebo simulator interaction:
Consider instructions in $SMART_ROOT_ACE/src/components/SmartGazeboBaseServer/README
1. Install SmartSoft infrastructure and the MDSD Toolchain (see http://servicerobotik-ulm.de/drupal/?q=node/34)
2. Install Gazebo 8.0 from http://gazebosim.org/download
3. Install gmapping, for mapping the simulation environment:
A pre build debian package with the lib is available:
wget -qO - http://packages.openrobotino.org/keyFile | sudo apt-key add - sudo echo "deb http://packages.openrobotino.org/xenial xenial main" > /etc/apt/sources.list.d/openrobotino.list sudo apt-get install gmapping
4. Compile all interface classes (could also be done using the SmartMDSD Toolchain):
cd $SMART_ROOT_ACE/src/interfaceClasses mkdir build cd build cmake .. make
5. Start the MDSD Toolchain
6. Import all interface classes from $SMART_ROOT_ACE/src/interfaceClasses
7. Import all components listed in 5 from $SMART_ROOT_ACE/src/components
8. Compile all necessary components of the scenario:
by using the SmartMDSD Toolchain, by right-clicking on each Component Project in the Project Explorer and select Compile SmartMDSD Project
9. Import DeployTiagoNavigation from $SMART_ROOT_ACE/src/deployments
10. With the SmartMDSD Toolchain, open the model of DeployTiagoNavigation and define a deployment directory in the Deployment tab by selecting the device block.
Continue with the section: Starting the scenario, see above.
If you use a virtual machine, the simulator will typically run very slow. Therefore it can be useful to run the simulator on the host system and the SmartSoft deployment for navigation further on the virtual machine (guest system). This can be easily accomplished since the Gazebo topics which serve as the communication medium between Gazebo and SmartSoft are based on TCP/IP Sockets. You just have to configure your host/guest system accordingly by setting some environment variables. If you use VirtualBox, a possible solution is given in the following:
1. Create a Host-only network (File → Preferences → Network → Host-only Networks → Press Add Symbol (+)) which enables communication between the host and the guest system.
This should add vboxnet0:
2. Configure your Virtual Machine network settings (Right-click on virtual machine and select Settings → Network) as follows:
You should be able to identify the IP address of vboxnet0 under the host system using ifconfig:
And the same for the guest system.
Then you have to set the following environment variables both on the host and guest system before starting the simulator or deployment of the navigation scenario, respectively:
GAZEBO_MASTER_URI=IP:Port # IP:Port where the Master runs GAZEBO_HOSTNAME=IP # Own IP
For example, let's assume:
The system where the Gazebo simulator is started is always the Master. Therefore on the host sytem, execute:
export GAZEBO_MASTER_URI=192.168.56.1:11345 export GAZEBO_HOSTNAME=192.168.56.1
before starting the simulator.
On the guest system, execute:
export GAZEBO_MASTER_URI=192.168.56.1:11345 export GAZEBO_HOSTNAME=192.168.56.101
before starting the navigation scenario.