Page tree
Skip to end of metadata
Go to start of metadata

This tutorial describes using both and onboard computer (shuttle PC on the P3AT) and an offboard computer (desktop) to control P3AT via joystick over wifi.

Preliminaries

Network Setup

In this tutorial our ROS network will be spread across two computers on the network.  You will need to know the IP addresses for both computers.  You should also verify that you can connect between the two computers as described in the ROS on Multiple Machines tutorial.

In the tutorial that follows we'll use this notation:

  • BASE_IP = the IP address of the base station - the desktop or laptop computer running the ROS master and joystick driver.
  • ROBOT_IP = the IP address of the computer on the robot running the Rosaria ROS node.

Make not of your own BASE_IP and ROBOT_IP addresses for substitution in the following instructions.

Base Station Setup

We'll designate a central PC as the base station, e.g., a desktop or laptop.  Because this computer has a keyboard, monitor, etc., this is how the user will interact with and debug the system.  You can find the IP address of your computer using the ifconfig command...

This tells us the IP address of the wireless network adapter (wlan0).  So we know that for this example BASE_IP=192.168.11.100

Following the joystick tutorial (see preliminaries), you'll plug in a Logitech joystick into the base PC.

We will want to explicitly set the ROS master URI and then run the roscore and joystick driver on Poke.

Master
export ROS_MASTER_URI=http://BASE_IP:11311
export ROS_IP=BASE_IP
export ROS_HOSTNAME=BASE_IP
roslaunch nre_joy teleop_ugv_joy_p3at.launch 

Make sure to substitute BASE_IP for the IP address of your setup!

Alternatively you could set an environmental variable with the BASE_IP value of your machine.

Master
export BASE_IP=192.168.11.120
export ROS_MASTER_URI=http://${BASE_IP}:11311
export ROS_IP=${BASE_IP}
export ROS_HOSTNAME=${BASE_IP}
roslaunch nre_joy teleop_ugv_joy_p3at.launch 

Or, even better yet, we can have the system get the IP address automatically in a short bash script like this..

Master
#/bin/bash
export BASE_IP=$(ifconfig wlan0 | grep 'inet addr' | cut -d: -f2 | awk '{print $1}')
echo "Setting ROS variable for BASE_IP="$BASE_IP
export ROS_MASTER_URI=http://${BASE_IP}:11311
export ROS_IP=${BASE_IP}
export ROS_HOSTNAME=${BASE_IP}
env | grep ROS
roslaunch nre_joy teleop_ugv_joy_p3at.launch 


We can use rqt_graph to check and see what is running....

You should see that two nodes are running - the /joydriver and the /joymapping.  The /joymapping publishes Twist messages on the /my_p3at/cmd_vel topic, but since nobody is listening, it doesn't show up on rqt_graph.  

We might also use rqt_topic to see what is going on and make sure that the joystick is causing Twist commands to be published.  It should look like this...

You might notice that the linear.x value in the Twist message is 1.0.  This is because I was holding up the joystick.  

Now lets talk to the robot.

Robot Station Setup

For this example we'll be using the computer "shuttle0" which is IP address 192.168.11.50 on the Coconut wireless.  So, ROBOT_IP=192.168.11.50.  Once you start the robot, and power on the shuttle PC you should be able to ping the shuttle from the base station like so...

Now we want to logon to the shuttle using ssh...

Now we need to run the P3AT driver on the shuttle PC, but we also want to make sure to tell ROS to look for the master on the base station.  

Master
export ROS_MASTER_URI=http://BASE_IP:11311
export ROS_IP=ROBOT_IP
export ROS_HOSTNAME=ROBOT_IP
rosrun rosaria RosAria _port:=/dev/ttyS0 __name:=my_p3at

Now you should see the RX and TX lights blinking on the Pioneer.  Your rqt_graph should also now look like this...

The ROS master and the two joystick nodes are running on the Base PC and the my_p3at node is running on the Shuttle PC

 

 

  • No labels