Robobot

From Rsewiki
(Difference between revisions)
Jump to: navigation, search
(DNSMASQ)
Line 24: Line 24:
  
 
===DNSMASQ===
 
===DNSMASQ===
 +
 +
To enable the robobot to be connected directly to a PC, then it is easier if the robobot provides an IP for the PC.
  
 
Install DNSMASQ
 
Install DNSMASQ

Revision as of 17:47, 6 December 2016

This page is for ROBOBOT, an extension of REGBOT with a raspberry pi and three wheels.

Contents

Installation instruction on the raspberry

Raspicam

A rather short raspberry pi camera API is available from https://www.uco.es/investiga/grupos/ava/node/40. And can be downloaded from https://sourceforge.net/projects/raspicam/files/?

Unpack and install:

unzip raspicam-0.1.3.zip
cd raspicam-0.1.3
mkdir build
cd build
cmake ..
make
sudo make install

Userland-master

To be able to install mobotware

Follow the guide under REGBOT for userland-master install - Install on raspberry

DNSMASQ

To enable the robobot to be connected directly to a PC, then it is easier if the robobot provides an IP for the PC.

Install DNSMASQ

sudo apt install dnsmasq

allow dnsmasq to provide IP to pear-to-pear networks Edit the /etc/dnsmasq.conf and change/add the following line (for eth0)

dhcp-range=eth0,192.168.0.100,192.168.0.150,12h

To work, the eth0 must have an IP, if noone provides one, change /etc/dhcpcd.conf (dhcp client deamon) to have a default IP, if no DHCP server is available

Add the following lines at the end of /etc/dhcpcd.conf

# define static profile
profile static_eth0
static ip_address=192.168.0.2/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

# fallback to static profile on eth0
interface eth0
fallback static_eth0 

# define static profile
profile static_eth1
static ip_address=192.168.1.2/24
static routers=192.168.1.1
#static domain_name_servers=192.168.0.1

# fallback to static profile on eth1
interface eth1
fallback static_eth1

This will also give a default IP for an eventual second network (usb-to-cable) if needed

Now, after a reboot, you should be able to connect a PC directly with at network cable to a PC, and the PC should get an IP from the raspberry, so now

ssh local@192.168.0.2

should work

Mobotware

Requires a number of packages - see Install on raspberry

ROBOBOT demo C++

This is an examplesoftware in C++ to access both raspberry camera and REGBOT, and with an example mission controlled from the raspberry.

Get the robobot software from the svn repository:

svn checkout svn://repos.gbar.dtu.dk/jcan/regbot/robobot robobot

To be able to compile the demo software CMAKE needs also to use the user installed library (raspicam installed above), so add the following line to ~/.bashrc:

export CMAKE_PREFIX_PATH=/usr/local/lib

Then build Makefiles and compile:

cd robobot
cd build
cmake ..
make

Then testrun the application:

./robobot

It should print that the camera is open, save an image and print some data from the robot (e.g. position).

USB as SOCKET for REGBOT client

To use the REGBOT client through (not on) the raspberry pi, the serial connection /dev/ttyACM0 on the raspberry can be converted to a network port by SOCAT. So install:

sudo apt install socat

Add the following line to /etc/rc.local

socat TCP-LISTEN:24001,fork,reuseaddr FILE:/dev/ttyACM0,raw,echo=0

This creates a TCP socket server, listening to port 24001 and piping /dev/ttyACM0 to the socket (with no local echo). This only takes the data from the /dev/ttyACM0 when a client is connected to the socket.

This is good for configuring the REGBOT (connect wifi 192.168.0.2:24001).

Works after a reboot, or the same line on the command prompt.

Share files from windows

To share files on all windows computers (without need for administrator) configure a samba share (or follow Simon on http://simonthepiman.com/how_to_setup_windows_file_server.php)

First install samba

sudo apt install samba samba-common-bin

then edit /etc/samba/smb.conf

comment out all lines under the headlines:

[homes]
[printers]
[print$]
[cdrom]

Add the following section at the end:

[robobot]
comment = Raspberry Pi user LOCAL home directory
path = /home/local
writeable = Yes
only guest = Yes
create mask = 0777
directory mask = 0777
browseable = Yes
public = yes


Add "local" and "pi" as a samba user (and set password, for user pi it should be "raspberry"):

sudo smbpasswd -a local
sudo smbpasswd -a pi

Reboot to implement

sudo reboot

Windows map drive

On the windows computer, connect a network cable directly between the robobot and the computer, e.g. using a USB to Ethernet converter. Robobot should now be available with network address 192.168.0.2 (you could try a ping if in doubt).

In the file browser:

  • select "map network drive" (menu tools, or right-click on "my computer").
  • select drive R: (for robobot) - or another if R is used already.
  • in the folder field write: \\192.168.0.2\robobot, and select "Connect using different credentials", then OK.
  • Type in username (local or pi) and the appropriate password (and OK).

Now the code and other files can be accessed and manipulated from windows, e.g. using an IDE.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox