-
Notifications
You must be signed in to change notification settings - Fork 0
sim_usage_wiki
NOTE: To run both Gazebo server and client on your local PC you need a powerful one! ideally with GPU.
-
Environment configuration (can be added to ~/scripts/personal_config/personal_config.sh)
export ROBOT_ENV=isr-testbed-sim export ROBOT=mbot05-with-arm # can also be set to "mbot05" if you don't need the arm
roslaunch mbot_simulation robot.launch --> alias bringup_sim
NOTE: In case the simulator does not run, or is too slow on your PC, then you might want to try to run the Gazebo server on harode PC and Gazebo client on your local PC (see instructions below)
Harode server is a powerful PC with a graphics card. Furthermore it can handle many Gazebo instances (many people can run simulator instances in different ports, and yes you can run many roscore on a single PC in different ports, see how below). To ensure different port usage, all members have to use their own port described below.
For the commands below, replace the X and Y with your assigned port (check table):
NOTE: No one is allowed to use the default ports : ROS (11311), GAZEBO (11345), unless you are using the simulator locally in harode server (in other words: if you are sitting in front of harode-server, using harode-server monitor)
| NAME | X (ROS PORT) | Y (GAZEBO PORT) |
|---|---|---|
| Carlos Azevedo | 12 | 46 |
| Rita Machado | 13 | 47 |
| Enrico Piazza | 14 | 48 |
| Guilherme Lawless | 15 | 49 |
| Inês Alexandre | 16 | 50 |
| Jhielson Pimentel | 17 | 51 |
| João Cartucho | 18 | 52 |
| João Gonçalves | 19 | 53 |
| Louis Chopot | 20 | 54 |
| Luis Luz | 21 | 55 |
| Miguel Silva | 22 | 56 |
| Mithun | 23 | 57 |
| Oscar Lima | 24 | 58 |
| Rute Luz | 25 | 59 |
| Tiago Dias | 26 | 60 |
| Raphael | 27 | 61 |
| Ivanna | 28 | 62 |
NOTE: If your name is not on the list, please add yourself in the consecutive number at the end or ask the simulator admin (Jhielson Pimentel or Oscar Lima) to add you.
-
Gazebo server (needs to be launched on harode-server)
-
The bellow blocks of code (alias) must be added in both harode PC and local PC bashrc, we suggest you to do it under
~/scripts/personal_config/personal_config.sh -
Depending on the network your local pc is connected to, choose the corresponding instructions (bellow).
Terminal 1
export ROS_MASTER_URI='http://10.0.2.69:113X'
roscore -p 113X
Terminal 2
export ROS_MASTER_URI='http://10.0.2.69:113X'
export GAZEBO_MASTER_URI='http://10.0.2.69:113Y'
bringup_sim
- Gazebo client - optional! (needs to be launched on your local PC)
export ROS_MASTER_URI='http://10.0.2.69:113X'
export GAZEBO_MASTER_URI='http://10.0.2.69:113Y'
rosrun gazebo_ros gzclient
The following example alias might help you to run the simulator remotely, with your own port in a fast way. Keep in mind you will need to replace myname with your name and X and Y with your assigned ports (see above info)
# to work with the simulator in harode
alias export_harode_myname='export DISPLAY=:0 && export ROS_MASTER_URI=http://10.0.2.69:113X && export GAZEBO_MASTER_URI=http://10.0.2.69:113Y' # needs to be runned on harode
alias roscore_harode_myname='export_harode_myname && roscore -p 113X' # needs to be runned on harode
alias rviz_harode_myname='export_harode_myname && rviz'
alias gzclient_harode_myname='export_harode_myname && rosrun gazebo_ros gzclient'
- Define the following alias in your local pc and harode server (
$HOME/scripts/personal_config/personal_config.sh) - Replace
mynamewith your name andXandYwith your assigned ports (see above info)
export HARODE_IP_EXTERNAL=10.0.21.147 # IP seen externally through ISR network
export HARODE_IP_INTERNAL=10.2.0.24 # IP seen inside ROAH24 network
# USING HARODE AS GAZEBO SERVER
# these alias are only useful in your local PC
export MY_IP=`get_interface_that_pings $HARODE_IP_EXTERNAL | get_ip_of_interface`
alias harode='ssh harode@$HARODE_IP_EXTERNAL'
alias export_harode_sim='export ROS_MASTER_URI='http://$HARODE_IP_EXTERNAL:113X' && export ROS_IP=$MY_IP && export GAZEBO_MASTER_IP='$HARODE_IP_EXTERNAL:113X' && export GAZEBO_MASTER_URI='http://$HARODE_IP_EXTERNAL:113Y' && export GAZEBO_IP=$MY_IP'
alias rviz_harode='export_harode_sim && rviz'
alias gzclient_harode_my_name='export_harode_sim && rosrun gazebo_ros gzclient'
# these alias are only useful inside harode
alias export_harode_my_name='export DISPLAY=:0 && export ROS_MASTER_URI=http://$HARODE_IP_INTERNAL:113X && export ROS_IP=$HARODE_IP_EXTERNAL && export GAZEBO_MASTER_URI=http://$HARODE_IP_INTERNAL:113Y && export GAZEBO_MASTER_IP=$HARODE_IP_INTERNAL && export GAZEBO_IP=$HARODE_IP_EXTERNAL' # needs to be runned on harode
alias roscore_harode_my_name='export ROS_MASTER_URI=http://$HARODE_IP_INTERNAL:113X && roscore -p 113X' # needs to be runned on harode
- Terminal 1 (roscore)
roscore_harode_my_name
- Terminal 2 (gazebo server)
export_harode_my_name
bringup_sim
- Gazebo client (local PC)
gzclient_harode_my_name
- Before Subscribing/Publishing to topics on local pc:
export_harode_sim
- ERROR during bringup_sim:
rospy.exceptions.ROSException: timeout exceeded while waiting for service /controller_manager/list_controllers
[automated_switch_ctrl_node-16] process has died [pid 13941, exit code 1, cmd /home/harode/ros_ws/src/mbot_simulation/mbot_gazebo_control/ros/scripts/automated_switch_ctrl __name:=automated_switch_ctrl_node __log:=...].
This can happen if gazebo is not properly starting or if the controllers are not being loaded. A possible solution is to check that gazebo can actually start (try roslaunch gazebo_ros empty_world.launch).
A possible reason for Gazebo not starting is incorrect environment variable GAZEBO_MASTER_URI, especially make sure the IP is correct, and the same as ROS_IP or the IP in ROS_MASTER_URI.
-
ERROR: gazebo version conflict. This error happens typically due to mismatch in gazebo versions when launching server and client in different PC's over ssh for example. Solution: With info from here just install same gazebo version on both systems. The version can be seen when launching the gzclient at startup in the lower right corner. To install gazebo 7.11 which is the one currenty installed on harode do:
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
cat /etc/apt/sources.list.d/gazebo-stable.list
wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install gazebo7
- spacenav mouse is moving my screen in gazebo gzclient when launching mbot cartesian controller: There is a closed issue that you can see here:
edit ~/.gazebo/gui.ini with the following content:
[spacenav]
deadband_x = 0.1
deadband_y = 0.1
deadband_z = 0.1
deadband_rx = 0.1
deadband_ry = 0.1
deadband_rz = 0.1
topic=~/spacenav/remapped_joy_topic_to_something_not_used
- gazebo not simulating images or pointclouds over ssh: There is a close issue on this here:
doing:
export DISPLAY=:0
should solve the issue