Explore environment
Here are a few things you might want to do to determine the environment you are working in.
See what's there
At a terminal prompt, use this command to list relevant environment variables.
$ env | grep MIRO
MIRO_STATIC_IP=
MIRO_DIR_TRASH=/home/miro/.miro2/trash
MIRO_NETWORK_MODE=dynamic
MIRO_DIR_PID=/tmp/miro2/pid
MIRO_DIR_STATE=/run/user/1001/miro2/state
MIRO_DIR_LOG=/tmp/miro2/log
MIRO_SPEAK_IP=1
MIRO_DYNAMIC_IP_MATCH=^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$
MIRO_SYSTEM_UPDATE_SCHEDULE=never
MIRO_DIR_DUMP=/tmp/miro2/dump
MIRO_ROBOT_NAME=miro
MIRO_DIR_SHARE=/home/miro/mdk/share
MIRO_MDK_RELEASE=R191016
MIRO_DIR_MDK=/home/miro/mdk
MIRO_EDITION=2
MIRO_TOKEN=miro2
MIRO_DIR_ONBOARD=/home/miro/mdk/bin/onboard
MIRO_MULTITOOL=/home/miro/mdk/bin/onboard/multitool.sh
MIRO_DIR_CONFIG=/home/miro/.miro2/config
MIRO_DIR_TMP=/tmp/miro2
MIRO_DYNAMIC_IP_WAIT=60
MIRO_DIR_BIN=/home/miro/mdk/bin/arm32
MIRO_ROS_RELEASE=kinetic
MIRO_DIR_USER=/home/miro/.miro2
MIRO_USER_SETUP=/home/miro/.miro2/config/user_setup.bash
MIRO_BRIDGE_FLAGS=l
MIRO_SYSTEM=arm32
Am I using a robot?
ROS control clients will generally work on the robot or the simulator, but at times you may want to know which you are working with.
You can determine whether your script is actually running on a robot using something like this.
$ [[ `hostname` == miropi ]] && echo "This script is running on board a robot" || echo "No it isn't"
This script is running on board a robot
$ [[ `hostname` == miropi ]] && echo "This script is running on board a robot" || echo "No it isn't"
No it isn't
To determine if the target you are talking to on the ROS interface is a robot (or a simulator), look for the flag MIRO_PLATFORM_U_FLAG_SIMULATOR
(miro.constants.PLATFORM_U_FLAG_SIMULATOR
) in the ROS topic sensors/flags.
You can access this, and other tests, through RobotInterface() in Python, as follows.
import miro2 as miro
i = miro.lib.RobotInterface()
print i.target_supports("is_running_on_robot")
print i.target_supports("is_robot")