Robobot

From Rsewiki
(Difference between revisions)
Jump to: navigation, search
(Overview)
 
(193 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
This page is for ROBOBOT, an extension of REGBOT with a raspberry pi and three wheels.
 
This page is for ROBOBOT, an extension of REGBOT with a raspberry pi and three wheels.
  
[[File:robobot.JPG|400px]]
+
<!--[[File:onshape-view.png|400px]] -->
 +
[[File:robobot_v5.png|400px]]
 +
[[File:melina_b.jpg|250px]]
 +
[[File:model-black.jpg | 450px]]
  
==Installation instruction on the raspberry==
+
Figure 1. Robobot, The robot is a 3D-printed box with wheels and some electronics.
 +
The third, fourth and fifth generations are shown here.
 +
The 3D printed parts can be found here https://cad.onshape.com/documents/fef8699fcafb8aea780c8981/w/ce38e7fdd6cf8533b65e2c3c/e/4792e876b254f8e35059f863
  
 +
== Overview ==
  
===Raspicam===
+
Note: Not valid (mostly) for the 2024 version of the robot
  
A rather short raspberry pi camera API is available from https://www.uco.es/investiga/grupos/ava/node/40.
+
===hardware ===
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===
+
ROBOBOT is based on a navigation box with a line sensor (Edge sensor), an IR distance sensor and possibly some servos, all controlled by a microprocessor.
 +
For more intelligent behaviour and more sensors, there is a Raspberry Pi in the box too,
  
To be able to install mobotware
+
The motors are JGB37-545 with an encoder and a 1:10 gearing (up to about 400RPM (or ~6 RPS (rotations per second) on the output axle).
  
Follow the guide under REGBOT for userland-master install - [[Install on raspberry]]
+
There is a video introduction and demo here https://www.youtube.com/watch?v=6dNr_F0dsHw (from 2022 - slight changes since)
  
===DNSMASQ===
+
=== Navigation box overview===
  
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
+
[[File:robobot-overview.png | 500px]]
  
sudo apt install dnsmasq
+
Figure 2. ROBOBOT is an extension of the robot REGBOT. The REGBOT part controls the wheels and interfaces to the sensors, like an IMU (6-axis accelerometer and gyro), IR distance sensors (2), and a line edge detector. The REGBOT further controls up to 5 servos and controls the battery supply. ROBOBOT is further equipped with a Raspberry Pi to allow more complicated missions. The Raspberry Pi runs an interface process called "Bridge" and is the main interface to the REGBOT. The mission process collects data from the bridge and the REGBOT and supplies small mission code snippets to be executed by the REGBOT part. The mission process may use the camera and the Open-CV library functions. The speaker allows debugging messages or other sound effects.
  
allow dnsmasq to provide IP to pear-to-pear networks
+
The ROBOBOT functions are available on the net at port number 24001. The existing user interface for REGBOT can access REGBOT functions from this port.
Edit the /etc/dnsmasq.conf (nano is a small text editor, fine for editing configuration files owned by Linux root)
+
  
sudo nano /etc/dnsmasq.conf
+
The gamepad can take control of the robot if the mission fails and can be used to initiate missions or other functions.
  
find and change/add the following line (for eth0)
+
==Software description==
  
dhcp-range=eth0,192.168.0.100,192.168.0.150,12h
 
  
To work, the eth0 must have an IP, if noone provides one,
+
=== Bridge software ===
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 to have a fall back behaviour for eth0 and eth1.
+
The Robobot bridge runs on the Raspberry Pi and is started when the Raspberry Pi starts, with initial commands from an initialization file (bridge.ini).
  
# define static profile
+
[[Robobot_bridge]] overview
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
+
A bridge autostart feature is implemented in the script 'start_bridge.sh' in the home directory of the user 'local'.
 +
The is executed after a reboot.
  
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
+
The script can be amended with other commands that should be started after a reboot.
  
ssh local@192.168.0.2
+
=== Mission software ===
  
should work
+
The mission application is the primary user control for the robot.
  
===Mobotware===
+
[[Robobot mission]] application overview.
  
Requires a number of packages - see [[Install on raspberry]]
+
The Mission application is started manually from an ssh console or added to the reboot script 'start_bridge.sh'.
 +
<!--
 +
===Python interface===
  
===ROBOBOT demo C++===
+
A python-based control example - including especially camera streaming and interface.
  
This is an examplesoftware in C++ to access both raspberry camera and REGBOT, and with an example mission controlled from the raspberry.
+
[[Python interface]]
 +
-->
  
Get the robobot software from the svn repository:
+
==Setup issues==
  
svn checkout svn://repos.gbar.dtu.dk/jcan/regbot/robobot robobot
+
===Installation instructions===
  
To be able to compile the demo software CMAKE needs also to use the user installed library (raspicam installed above),  
+
This installation should be done already, to update see next section.
so add the following line to ~/.bashrc:
+
  
export CMAKE_PREFIX_PATH=/usr/local/lib
+
[[Raspberry and ROS]] (not finished)
  
Then build Makefiles and compile:
+
[[Network setup]] (Wifi)
  
cd robobot
+
[[Robobot camera]] camera setup
cd build
+
cmake ..
+
make
+
  
Then testrun the application:
+
[[Access from Windows]] and Linux to Raspberry files (and graphics)
  
./robobot
+
[[Other windows tools]] - show Raspberry Pi graphics in Windows (usually very very slow)
  
It should print that the camera is open, save an image and print some data from the robot (e.g. position).
+
[[Regbot GUI]] python setup and GUI install
  
===USB as SOCKET for REGBOT client===
+
See [[Regbot calibration]] for sensor calibration.
  
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:
+
===Software update===
  
sudo apt install socat
+
Update of the maintained software is on the SVN (subversion) repository.
  
Add the following line to /etc/rc.local
+
SSH to the robot and go to these directories and do an update
  
  socat TCP-LISTEN:24001,fork,reuseaddr FILE:/dev/ttyACM0,raw,echo=0
+
  cd
 +
svn up svn/fejemis/ROS/catkin_ws/src/bridge
 +
svn up svn/robobot
 +
svn up svn/regbot
  
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.
+
An update could look like this
 +
$ svn up svn/fejemis/ROS/catkin_ws/src/bridge
 +
Updating 'svn/fejemis/ROS/catkin_ws/src/bridge':
 +
U    fejemis/ROS/catkin_ws/src/bridge/udataitem.h
 +
U    fejemis/ROS/catkin_ws/src/bridge/ujoy.cpp
 +
Updated to revision 228.
  
Works after a reboot, or the same line on the command prompt.
+
NB! this may cause a conflict if some of the files are changed locally.
 +
Look at the filename and if it is not one of yours, then reply 'tc' (short for their conflict solution)
  
This is good for configuring the REGBOT (in REGBOT client connect wifi to IP of robot, e.g. 192.168.0.2).
+
=====Compile on bridge changes=====
  
===Share files from windows===
+
If there are updated files for the bridge, then
  
To share files on all windows computers (without need for administrator) configure a samba share
+
cd
(or follow Simon on http://simonthepiman.com/how_to_setup_windows_file_server.php)
+
cd catkin_ws
 +
catkin_make
  
First install samba
+
=====Compile and upload on Teensy changes=====
  
  sudo apt install samba samba-common-bin
+
cd
 +
cd svn/regbot/regbot/4.1
 +
make -j3
 +
 
 +
This makes a file "regbot.hex" that is then to be loaded as the new firmware on the Teensy processor.
 +
 
 +
There is a script that can do that from the command line:
 +
 
 +
./upload.sh
 +
 
 +
It will say something like
 +
 
 +
$ ./upload.sh
 +
Teensy Loader, Command Line, Version 2.2
 +
Read "regbot.hex": 314368 bytes, 3.9% usage
 +
Waiting for Teensy device...
 +
  (hint: press the reset button)
 +
 
 +
Press and hold the "POWER ON" and then press the button on the Teensy board.
 +
 
 +
The "POWER ON" button maintains power to the Raspberry Pi and the Teensy while uploading.
 +
 
 +
It will likely fail the first time but keep pressing "POWER ON" and repeat the command, and it should now say
 +
 
 +
$ ./upload.sh
 +
Teensy Loader, Command Line, Version 2.2
 +
Read "regbot.hex": 314368 bytes, 3.9% usage
 +
Found HalfKay Bootloader
 +
Programming.............................
 +
Booting
 +
 
 +
If you released the "POWER ON" in the process, the Raspberry Pi would power down. You then need to hold the "POWER ON" until the Raspberry has booted; you then re-login and rerun the script.
 +
 
 +
=====Make the upload.sh=====
 +
 
 +
If you have the "upload.sh", this step is not needed.
 +
 
 +
The command line upload is described here https://www.pjrc.com/teensy/loader_cli.html .
 +
 
 +
On a Raspberry you first need to install a USB library:
 +
 +
  sudo apt install libusb-dev
 +
 
 +
Then get the code:
 +
 +
cd ~/git
 +
git clone https://github.com/PaulStoffregen/teensy_loader_cli.git
 +
cd teensy_loader_cli
 +
make
  
then edit /etc/samba/smb.conf
+
You should now have a "teensy_loader_cli" file; copy this to the svn/regbot/regbot/4.1 directory
  
  sudo nano /etc/samba/smb.conf
+
  cp teensy_loader_cli ~/svn/regbot/regbot/4.1/
  
comment out all lines under the headlines:
+
Make the "upload.sh" script
[homes]
+
[printers]
+
[print$]
+
[cdrom]
+
  
Add the following section at the end:
+
cd ~/svn/regbot/regbot/4.1
 +
nano upload.sh
  
[robobot]
+
Insert the following into the script:
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
+
  
 +
#!/bin/bash
 +
./teensy_loader_cli -v -w --mcu=TEENSY41 regbot.hex
  
Add "local" and "pi" as a samba user (and set password, for user pi it should be "raspberry"):
+
Save with ctrl-s and exit with ctrl-x
  
sudo smbpasswd -a local
+
Make the script executable
sudo smbpasswd -a pi
+
  
Reboot to implement
+
chmod +x upload.sh
  
sudo reboot
+
== old instructions ==
  
====Windows map drive====
+
Partially valid only.
  
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).
+
[[Install on raspberry]] on a clean SD-card - raspi-config.
  
In the file browser:
+
[[Setup user local]] adding a new user.
* 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.
+
[[Linux tools]] - packages to install.
  
* But the code still needs to be compiled on the raspberry (install and use putty for a ssh terminal access)
+
[[Access from PC]] (Linux or Windows).
  
===Share files on Linux===
+
[[Other windows tools]] - run graphics from Windows
  
On the Linux PC use sshfs for sharing rather than samba.
+
[[Instructions for getting started]] - primarily network, Linux intro and wifi setup.
Make an empty directory for the mapped disk, and then mount
+
  
mkdir robobotdisk
+
<!-- [[Full installation instructions]] - like Linux itself, sound and camera and how to connect the Raspberry disk to Windows and Linux computers. -->
sshfs local@192.168.0.2: robobotdisk
+
  
Unmount with
+
==REGBOT setup ==
  
fusermount -u robobotdisk
+
Several parameters in the REGBOT part of the robot need setting.
  
Or use "sudo unmount robobotdisk"
+
Some suggestions are provided here using the REGBOT GUI (available on the raspberry in the 'regbotgui' directory, and in a Windows version):
  
 +
[[Regbot settings]]
  
==Getting started==
+
=== Hardware ===
This section contains a quick-start guide for the user.
+
  
It includes how to get the robot connected to Eduroam WiFi for easy access, an explanation of software and software structure and present a few examples to get the robots driving.
+
The Robobot frame is 3D printed, the design is in onshape - see this link https://cad.onshape.com/documents/fef8699fcafb8aea780c8981/w/ce38e7fdd6cf8533b65e2c3c/e/4792e876b254f8e35059f863 , in the list of parts to the left it is possible to export (right-click) as STL files, that you can slice for your 3D printer.
  
Press the link below to go to the instructions page.
+
=== Navigation box assembly ===
  
[[Instructions for getting started]]
+
There are video-instructions on the course page.

Latest revision as of 16:16, 28 February 2024

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

Robobot v5.png Melina b.jpg Model-black.jpg

Figure 1. Robobot, The robot is a 3D-printed box with wheels and some electronics. The third, fourth and fifth generations are shown here. The 3D printed parts can be found here https://cad.onshape.com/documents/fef8699fcafb8aea780c8981/w/ce38e7fdd6cf8533b65e2c3c/e/4792e876b254f8e35059f863

Contents

[edit] Overview

Note: Not valid (mostly) for the 2024 version of the robot

[edit] hardware

ROBOBOT is based on a navigation box with a line sensor (Edge sensor), an IR distance sensor and possibly some servos, all controlled by a microprocessor. For more intelligent behaviour and more sensors, there is a Raspberry Pi in the box too,

The motors are JGB37-545 with an encoder and a 1:10 gearing (up to about 400RPM (or ~6 RPS (rotations per second) on the output axle).

There is a video introduction and demo here https://www.youtube.com/watch?v=6dNr_F0dsHw (from 2022 - slight changes since)

[edit] Navigation box overview

Robobot-overview.png

Figure 2. ROBOBOT is an extension of the robot REGBOT. The REGBOT part controls the wheels and interfaces to the sensors, like an IMU (6-axis accelerometer and gyro), IR distance sensors (2), and a line edge detector. The REGBOT further controls up to 5 servos and controls the battery supply. ROBOBOT is further equipped with a Raspberry Pi to allow more complicated missions. The Raspberry Pi runs an interface process called "Bridge" and is the main interface to the REGBOT. The mission process collects data from the bridge and the REGBOT and supplies small mission code snippets to be executed by the REGBOT part. The mission process may use the camera and the Open-CV library functions. The speaker allows debugging messages or other sound effects.

The ROBOBOT functions are available on the net at port number 24001. The existing user interface for REGBOT can access REGBOT functions from this port.

The gamepad can take control of the robot if the mission fails and can be used to initiate missions or other functions.

[edit] Software description

[edit] Bridge software

The Robobot bridge runs on the Raspberry Pi and is started when the Raspberry Pi starts, with initial commands from an initialization file (bridge.ini).

Robobot_bridge overview

A bridge autostart feature is implemented in the script 'start_bridge.sh' in the home directory of the user 'local'. The is executed after a reboot.

The script can be amended with other commands that should be started after a reboot.

[edit] Mission software

The mission application is the primary user control for the robot.

Robobot mission application overview.

The Mission application is started manually from an ssh console or added to the reboot script 'start_bridge.sh'.

[edit] Setup issues

[edit] Installation instructions

This installation should be done already, to update see next section.

Raspberry and ROS (not finished)

Network setup (Wifi)

Robobot camera camera setup

Access from Windows and Linux to Raspberry files (and graphics)

Other windows tools - show Raspberry Pi graphics in Windows (usually very very slow)

Regbot GUI python setup and GUI install

See Regbot calibration for sensor calibration.

[edit] Software update

Update of the maintained software is on the SVN (subversion) repository.

SSH to the robot and go to these directories and do an update

cd
svn up svn/fejemis/ROS/catkin_ws/src/bridge
svn up svn/robobot
svn up svn/regbot

An update could look like this

$ svn up svn/fejemis/ROS/catkin_ws/src/bridge
Updating 'svn/fejemis/ROS/catkin_ws/src/bridge':
U    fejemis/ROS/catkin_ws/src/bridge/udataitem.h
U    fejemis/ROS/catkin_ws/src/bridge/ujoy.cpp
Updated to revision 228.

NB! this may cause a conflict if some of the files are changed locally. Look at the filename and if it is not one of yours, then reply 'tc' (short for their conflict solution)

[edit] Compile on bridge changes

If there are updated files for the bridge, then

cd
cd catkin_ws
catkin_make
[edit] Compile and upload on Teensy changes
cd
cd svn/regbot/regbot/4.1
make -j3

This makes a file "regbot.hex" that is then to be loaded as the new firmware on the Teensy processor.

There is a script that can do that from the command line:

./upload.sh

It will say something like

$ ./upload.sh
Teensy Loader, Command Line, Version 2.2
Read "regbot.hex": 314368 bytes, 3.9% usage
Waiting for Teensy device...
 (hint: press the reset button)

Press and hold the "POWER ON" and then press the button on the Teensy board.

The "POWER ON" button maintains power to the Raspberry Pi and the Teensy while uploading.

It will likely fail the first time but keep pressing "POWER ON" and repeat the command, and it should now say

$ ./upload.sh
Teensy Loader, Command Line, Version 2.2
Read "regbot.hex": 314368 bytes, 3.9% usage
Found HalfKay Bootloader
Programming.............................
Booting

If you released the "POWER ON" in the process, the Raspberry Pi would power down. You then need to hold the "POWER ON" until the Raspberry has booted; you then re-login and rerun the script.

[edit] Make the upload.sh

If you have the "upload.sh", this step is not needed.

The command line upload is described here https://www.pjrc.com/teensy/loader_cli.html .

On a Raspberry you first need to install a USB library:

sudo apt install libusb-dev

Then get the code:

cd ~/git
git clone https://github.com/PaulStoffregen/teensy_loader_cli.git
cd teensy_loader_cli
make

You should now have a "teensy_loader_cli" file; copy this to the svn/regbot/regbot/4.1 directory

cp teensy_loader_cli ~/svn/regbot/regbot/4.1/

Make the "upload.sh" script

cd ~/svn/regbot/regbot/4.1
nano upload.sh

Insert the following into the script:

#!/bin/bash
./teensy_loader_cli -v -w --mcu=TEENSY41 regbot.hex

Save with ctrl-s and exit with ctrl-x

Make the script executable

chmod +x upload.sh

[edit] old instructions

Partially valid only.

Install on raspberry on a clean SD-card - raspi-config.

Setup user local adding a new user.

Linux tools - packages to install.

Access from PC (Linux or Windows).

Other windows tools - run graphics from Windows

Instructions for getting started - primarily network, Linux intro and wifi setup.


[edit] REGBOT setup

Several parameters in the REGBOT part of the robot need setting.

Some suggestions are provided here using the REGBOT GUI (available on the raspberry in the 'regbotgui' directory, and in a Windows version):

Regbot settings

[edit] Hardware

The Robobot frame is 3D printed, the design is in onshape - see this link https://cad.onshape.com/documents/fef8699fcafb8aea780c8981/w/ce38e7fdd6cf8533b65e2c3c/e/4792e876b254f8e35059f863 , in the list of parts to the left it is possible to export (right-click) as STL files, that you can slice for your 3D printer.

[edit] Navigation box assembly

There are video-instructions on the course page.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox