Overview
You may like to wirelessly interface with MIRO using the included ROS interface.
Configuration
Installation requirements
Run ROS core on workstation
In a shell, start the ROS core, as follows.
Run USB-ROS bridge on MIRO
MIRO must be running the USB-ROS bridge in order to expose a ROS interface to the network. You can start this manually, after logging in to MIRO, as follows.
root@miro:~> run_bridge_ros.sh
________________________________________________________________
MIRO tools [miro_bridge]
Copyright (C) 2019 Consequential Robotics
________________________________________________________________
device: /dev/P2
network: ROS (/miro/rob01)
sync_interval: (do not change)
frame: (do not change)
sound: /home/root/sound
mdk: R170209
________________________________________________________________
[000.000] enter threadproc
[000.001] interf opening (FLAGS=0x8)...
[000.002] start thread
[000.012] open() /dev/P2 OK
[000.015] opened
[000.021] initializing ROS...
[000.054] attempting to contact ROS master...
[000.059] upstream connection validated
[000.194] loading sound from: /home/root/sound
[000.309] finished: total RAM used is 1171 kiB
[000.310] advertising main topics...
[005.324] hooking SIGINT
[005.330] received: PLATFORM_READY
[005.331] sending P2_W_SYNC [n_hi=0]... [MIRO_USB_OK]
[005.334] read model_pars persist file... NOT FOUND!
[005.335] sending SET_MODEL_PARS... [MIRO_USB_OK]
[005.336] sending SET_RTC (16:25:08)... [MIRO_USB_OK]
[005.356] received (in msg_id=57445): ACK_SET_MODEL_PARS
[005.357] received (in msg_id=57445): ACK_SET_RTC
For clarity, all WARNINGs have been stripped from the trace, above—a handful of warnings whilst the bridge starts up and settles are to be expected, and can safely be ignored.
If you want to start the bridge in the background, instead, you can use
start_bridge.sh
instead—make sure it is configured to use
MODE=normal
first, and stop it using
stop_bridge.sh
.
Test ROS connectivity
If the bridge has started correctly, you will be able to see the interface exposed by MIRO by running rostopic
on your workstation, as shown below.
$ rostopic list
/miro/rob01/bridge/config
/miro/rob01/bridge/stream
/miro/rob01/core/config
/miro/rob01/core/control
/miro/rob01/core/state
/miro/rob01/log
/miro/rob01/platform/caml
/miro/rob01/platform/caml/compressed
/miro/rob01/platform/caml/compressed/parameter_descriptions
/miro/rob01/platform/caml/compressed/parameter_updates
/miro/rob01/platform/caml/compressedDepth
/miro/rob01/platform/caml/compressedDepth/parameter_descriptions
/miro/rob01/platform/caml/compressedDepth/parameter_updates
/miro/rob01/platform/caml/theora
/miro/rob01/platform/caml/theora/parameter_descriptions
/miro/rob01/platform/caml/theora/parameter_updates
/miro/rob01/platform/camr
/miro/rob01/platform/camr/compressed
/miro/rob01/platform/camr/compressed/parameter_descriptions
/miro/rob01/platform/camr/compressed/parameter_updates
/miro/rob01/platform/camr/compressedDepth
/miro/rob01/platform/camr/compressedDepth/parameter_descriptions
/miro/rob01/platform/camr/compressedDepth/parameter_updates
/miro/rob01/platform/camr/theora
/miro/rob01/platform/camr/theora/parameter_descriptions
/miro/rob01/platform/camr/theora/parameter_updates
/miro/rob01/platform/config
/miro/rob01/platform/control
/miro/rob01/platform/mics
/miro/rob01/platform/sensors
/miro/rob01/platform/state
/rosout
/rosout_agg
This shows that the default name for the robot on the network is rob01
.
Troubleshooting
If this test has not worked, you should first make sure of the following.
- On board your MIRO, the environment variables
ROS_IP
and ROS_MASTER_IP
are set correctly (to the IP of P3, and of your workstation, respectively) before the bridge starts—see run_bridge_ros.sh
.
- On your workstation,
ROS_IP
has been set to the workstation's own IP address, as detailed in Install ROS.
Note that if you have chosen a network configuration other than that described here you should take your own steps to ensure that both your robot and your ROS master are configured so that they can find each other.
Exchanging data with your MIRO from your
workstation requires a low-latency network connection—if you are in a busy radio environment, or the wireless network is weak, you will probably have trouble establishing communications.
Run client
We provide an example interpreted Python Command-line Client on-board MIRO for you to use as a starting point. It also works to test that the preparations, above, have been performed correctly.
MIRO is going to move! Support it with its wheels off the ground, or ensure that it can move around safely.
$ cd ~/mdk/bin/shared
$ ./miro_ros_client.py robot=rob01
initialising...
2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609]
turn left
tick
drive forward
tock
tick
turn right
tock
tick
drive forward
tock
tick
turn left
...
The client's main thread produces tick, tock, periodically. Meanwhile, each time a message arrives from the bridge with updated platform_sensors
data, a message is sent back down, and the robot is driven in a forward-turn-forward-turn pattern, indefinitely.
Moving on
You can try any one of the client Examples, they will all run against the configuration above. The Python GUI Client, in particular, gives you access to most of the robot interface.