The team met for the first time since Robocup, but with OpenCV installed and working, we began to make some actual progress. Before we start describing that, it’s important to note that we now have an easy way to transfer files to and from the Pi without the need for a USB mass storage device. Unable to find a USB to transfer the code backups back to the Pi, I fired up FileZilla and attempted to connect to the Pi. Once I got it working, I wrote up the instructions below:
Using FTP to transfer files to and from the Pi
Connect the Raspberry Pi to the computer via Ethernet
Launch “FileZilla” or your preferred FTP client on the computer
Enter “raspberrypi.mshome.net” in the “Host” field
Enter the Raspberry Pi credentials in Username and Password (Default: Username ‘Pi’ and password ‘raspberry’)
Enter “22” in the “Port” field
Troubleshooting
Problem: “Syntax error” dialogue box: “Invalid protocol specified”
Solution: Ensure the protocol in the host box is set to “sftp://”. sftp is for File Transfer over SSH. Leaving the host blank will let the port you specify (port 22 for sftp) set the protocol.
And now for the rest of the log:
Ryan created camera calibration and line following algorithms (see below) while I reattached the robot arm and set up the Raspberry Pi to start programming it. With OpenCV installed and working, Ryan and I set about creating a test script to take an image, which… didn’t work. We’ll look into it further next time, and perhaps test a script made by someone else.
Algorithms
Calibrate camera
Connect to Ps3 controller
Put the robot down so it can see both white
Open connection from camera.
Get current frame from camera.
Turn the picture gray
Crop two rectangles on left and right
Get the average for the two and store it in a variable as white
Wait until ‘X’ is pressed
Put the robot down so it can see black
Open connection from camera.
Get current frame from camera.
Turn the picture gray
Crop two rectangles on left and right
Get the average for the two and store it in a variable as black
Wait until ‘X’ is pressed
Put the robot down so it can see green
Open connection from camera.
Get current frame from camera.
Turn the picture gray
Crop two rectangles on left and right
Get the average for the two and store it in a variable as green
Wait until ‘X’ is pressed
Start line following.
Line following algorithm (With fixed camera)
Calibrate the camera.
Loop forever
Open connection from camera.
Get current frame from camera.
Turn the picture gray
Crop two rectangles on left and right
Find the average pixel intensity of each rectangle
Using the data from the calibration, check if
Both see white, continue forward
One sees black, turn towards it until white
One sees green, turn towards it until white
Both sees black, continue forward