jueves, 4 de julio de 2013

Basic WiFi communication setup part 2


This is a continuation from the previous post: http://asctecbasics.blogspot.com/2013/06/basic-wifi-communication-setup-part-1.html

Testing everything is OK

First, let's check the previous steps are OK. Let's assume you assigned 192.168.0.15 to your computer and 192.168.0.16 to your quad.

From your computer you should be able to ping your quad, run in a terminal:

 ping 192.168.0.16  

The same should work  from your quad to your computer changing the IP address correspondingly.

Setting up SSH

This part is based on the instructions found here: http://teamprincipia.wordpress.com/2008/05/29/beginning-ssh-on-ubuntu/ 

You need to install SSH client and server on both machines (client usually comes with Ubuntu  but checking is always good):

 sudo apt-get install openssh-client openssh-server  

Mapping IP addresses to hostnames

This part is based on information found here: http://nootrix.com/2012/06/ros-networking/

The idea is to associate the IP address to a name, so it isn't necessary to write the IP address everytime you wish to login through SSH.

To do this, first edit the /etc/hosts files on the computer being used as groundstation (assuming you are using the same IPs mentioned before):

 sudo gedit /etc/hosts  

Then add the following line at the end of the file:

 192.168.0.16 quad

Do the same on the quadrotor, adding this line instead:

 192.168.0.15 groundstation

Now you should be able to open a terminal on the computer and ping the quadrotor using the following command:

 ping quad

This should have a similar result as doing a ping from the quadrotor from the computer. Check both pings are possible to be sure everything is ok.

Running ROS

After setting up ssh and mapping the names, you should be able to run ROS on the quadrotor using commands from the groundstation, and start nodes on the groundstation to communicate with the quadrotor.

To check this we will run a listener node on the quadrotor and try to communicate to it from the computer.

You should choose if the groundstation or the quadrotor will run the roscore service. In this case the quadrotor will be running roscore.

To do this, from the groundstation computer log in to the quadrotor. Assuming the username on the quadrotor is "user", open a terminal on your computer and type:

 ssh user@quad 

Your password will be required for this. Type it and now you should have a terminal logged into the quadrotor. In this terminal type:

 roscore 

Now repeat this process, openning a new terminal and logging into the quadrotor and start a listener node on it typing:
 
 rosrun rospy_tutorials listener.py

Now you should set up the groundstation. Open a new terminal on your computer and type:
 
 export ROS_MASTER_URI=http://quad:11311
 rosrun rospy_tutorials talker.py 

Now you should see the answer on the listener terminal, showing the communication is working between both.

What's next?

Now everything is set up, you should try to run the asctec_mav_framework package on the quadrotor and communicate to it from the groundstation.


No hay comentarios:

Publicar un comentario