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


Most of the scripts for these instructions are included in the Git repository: https://github.com/bsb808/kingfisher_utils

Wireless Setup

Ideally you will have simultaneous wired (for access to the internet) and wireless (for access to the kingfisher) connections.

  • Setup the laptop for simultaneous wired and wireless networking as explained here: Robotics Computation Lab
  • In this example I am connected via wired to the NPS network and via wireless to the "Clearpath Base Station"

Test Wireless Connection

Before setting up, make sure you can connect through the wireless network.

  1. Test that you can connect to the wifi hub (aka base station).  In this case the base station's IP address is 192.168.131.9
    1. ping 192.168.131.9 - see if you are connected.
    2. Open a web browser and go to the IP address to see the router's web page.
      From there you can determine if the robot is connected and what IP address it might be using
      1. Go to Network -> DHCP, you should see something like this...
  2. Test that you can connect to the robot.  In this case we have determined that the robot's IP address is 192.168.131.230.
    1. ping 192.168.131.230
    2. ssh administrator@192.168.131.230 (password is 'clearpath')

Connecting Laptop to KF via Wireless

  1. Open terminal on Laptop (need to do this on each terminal you use)
  2. Edit the scripts/kf_connect_wifi.bash script (in the kingfisher_utils ROS package) with the appropriate IP addresses.  You will at least need to change the "MY_WLAN" variable to match the IP address of your machine.
    1. Also note that the script assumes your wireless device is wlan0.  You should double check the name of your wirless network interface using the command ifconfig. If your network device is under a different name, change the script to reflect your setup.
  3. Execute source scripts/kf_connect_wifi.bashwhich looks something like this...

    # Source this file to set environmental variable and set route
    MY_WLAN=192.168.131.221  # Wireless address of my laptop
    KF_WLAN=192.168.131.230 # Wireless address of Kingfisher
    KF_ETH=192.168.1.11 # Wired for Kingfisher, where ROS master lives
    #sudo route add -net ${KF_ETH} netmask 255.255.255.255 gw ${KF_WLAN}
    export ROS_IP=${MY_WLAN} # My laptop
    export ROS_MASTER_URI=http://${KF_ETH}:11311
    export ROS_HOSTNAME=${MY_WLAN}
    # Do this last - if you do it twice it throws an error and stops
    sudo route add -host ${KF_ETH} gw ${KF_WLAN} dev wlan0
  4. You need to do this in each terminal you are using!
  5. Check that this was successful

     `env | grep ROS`
    
    Results should look like
    ```
    ROS_ROOT=/opt/ros/kinetic/share/ros
    ROS_PACKAGE_PATH=/home/leevanhoutte/kf_ws/src:/home/leevanhoutte/catkin_ws/src:/opt/ros/kinetic/share
    ROS_MASTER_URI=http://192.168.1.11:11311
    ROS_VERSION=1
    ROS_HOSTNAME=192.168.131.243
    ROSLISP_PACKAGE_DIRECTORIES=/home/leevanhoutte/kf_ws/devel/share/common-lisp:/home/leevanhoutte/catkin_ws/devel/share/common-lisp
    ROS_DISTRO=kinetic
    ROS_IP=192.168.131.243
    ROS_ETC_DIR=/opt/ros/kinetic/etc/ros
    ```

Setup ROS Workspace


# Setup local ROS environment, otherwise it won't know about kingfisher_msgs

source ~/kf_ws/devel/setup.bash 

Test Incoming Connection


Now verify that you are able to yous should be able to run rosnode list and see all the nodes running on the KF.  You should see something like this...

Test Outgoing Connection


Test that you can publish from your laptop and that the commands make it to the robot

rostopic pub -r 10 /cmd_drive kingfisher_msgs/Drive '{left: 0.05, right: 0.0}'

You should hear the motor spin (if you are running on shore power it might will beep and spin only a small amount since the power supply can't provide enough current).


Note: If you see the error "ERROR: invalid message type: kingfisher_msgs/Drive" you need to install the kingfisher-msgs ROS package.  How you do this may depend on your distribution of Ubuntu and ROS

Ubuntu 14.04 and ROS Indigo

For this setup, there are precompiled Ubuntu packages which can be installed with...

 sudo apt-get install ros-indigo-kingfisher-msgs ros-indigo-kingfisher-description

Ubuntu 16.04 and ROS Kinetic

For this setup we'll need to use the source repository.

cd catkin_ws/src
git clone https://github.com/kf/kingfisher.git
cd catkin_ws
catkin_make
source devel/setup.bash 


Driving with Joystick

Now, in a new terminal use the following launch file to start the joystick nodes.

roslaunch kingfisher_utils kingfisher_tankdrive.launch


MATLAB Snippet

rosinit('http://192.168.131.203:11311')
kfpub = rospublisher('/cmd_drive',rostype.kingfisher_msgs_Drive);
kfmsg = rosmessage(kfpub)
kfmsg.Left = 0.1
send(kfpub,kfmsg)






# Source this file to set environmental variable and set routeMY_WLAN=192.168.131.221  # Wireless address of my laptopKF_WLAN=192.168.131.230 # Wireless address of KingfisherKF_ETH=192.168.1.11 # Wired for Kingfisher, where ROS master lives#sudo route add -net ${KF_ETH} netmask 255.255.255.255 gw ${KF_WLAN}export ROS_IP=${MY_WLAN} # My laptopexport ROS_MASTER_URI=http://${KF_ETH}:11311export ROS_HOSTNAME=${MY_WLAN}# Do this last - if you do it twice it throws an error and stopssudo route add -host ${KF_ETH} gw ${KF_WLAN} dev wlan0

kfpub = rospublisher('/cmd_drive',rostype.kingfisher_msgs_Drive);

  • No labels