Raspberry Pi Robotics code for developing and programming robotics as part of CSA (AP Computer Science Applications) test prep curriculum
##Installation
First, install the Raspbian OS image onto your Raspberry pi.
Next, install the latest version of java onto your Raspberry pi:
Now you need to change the JAVA_HOME so that the latest version runs in terminal. Navigate to the folder where the jdk you just installed is (it should be in “/usr/lib/jvm/jdk-8-oracle-arm32-vpm32-vpf-hflt”).
Open terminal and navigate to root by typing “cd” (typing “cd” brings you all the way back to the base of the folder tree no matter what folder you were located in previously):
Then, navigate the folder “etc”:
Open the document “environment” (sudo is required otherwise changes cannot be saved):
You are now inside the document “environment”. Type the filepath of the jdk:
Save and exit the document.
Check to make sure the development kit is set up right by typing the command:
It should print out as something that starts with 1.8.
###Install and configure Motion camera server
Navigate back to the root folder by typing “cd”, then enter the command:
Choose Camera and select “Enable support for Raspberry Pi camera”. The, reboot your raspi:
test camera command:
Run command:
Then run command:
Upgrade will take more than twenty minutes to execute. Most school networks will block at least a portion of these installs so its best to be installing under a different network or vpn from here on. If an instillation is finishing by saying “such and such was not installed” then it means certain parts were blocked.
Run command:
This will take a while. Run this command(make sure you type a lowercase “L” not a “1”):
Navigate to root:
Activate drivers by opening file “modules”:
Append the following line to the very end of the file:
Save file and close. Then open the document “motion”:
search for start_motion_daemon and change it from no to yes. Should look like this:
The rest is configuring motion
Run command to create backup:
run command:
Change all of the lines in the configuration file to match the lines written below:
Allow motion to run the daemon we’ve set earlier:
Set the logfile (important to debug motion if you webservers crashes):
We want to be able to access the stream outside off the Pi’s localhost:
Set the framerate of the stream (100 for higher quality):
Set the width and height of your video:
Control de port 8080 by default:
Be careful not to set the stream_port to be just like the webcontrol port.
Save and exit.
Open /etc/init.d/motion by:
Change everything from “start)” to “;;” so it is exactly as follows:
start)
if check_daemon_enabled ; then
if ! [ -d /var/run/motion ]; then
mkdir /var/run/motion
fi
chown motion:motion /var/run/motion
#export LD_PRELOAD=/usr/lib/uv4l/uv4lext/armv6l/libuv4lext.so
sudo modprobe bcm2835-v4l2
chmod 777 /var/run/motion
# this is the fix we've added to allow the network share to be connected first before we try to start motion:#
sleep 30
log_daemon_msg "Starting $DESC" "$NAME"
if start-stop-daemon --start --oknodo --exec $DAEMON -b --chuid motion ; then
log_end_msg 0
else
log_end_msg 1
RET=1
fi
fi
;;
Save and exit.
download zip file of our code Unzip the file and move it to the root of the system.
Find the ip of the raspberry pi by typing the command:
inside the file SWHS_RaspiJavaRobotics/public_html/index.html search, for “ip=”, change the ip after “http://” to be the ip of your raspi on your wifi.
Save and exit.
Download SSH software with a GUI (I like the software “PuTTY”) onto the computer you are using to connect to your Raspberry pi.
Navigate to the configuration menu of your Raspberry pi by typing the following command into your terminal:
Then navigate to “Interfacing Options” using your arrow keys, press enter.
Select SSH.
When prompted with “Would you like the SSH server to be enabled”, select yes.