Team Members: Pooja Bansal (Pbansal2) Suraj Shanbhag (Smshanbh)
Total Page:16
File Type:pdf, Size:1020Kb
ARDUROVER with BBBmini Project made for ECE 785 Advanced Computer Design Team Members: Pooja Bansal (pbansal2) Suraj Shanbhag (smshanbh) OVERVIEW: The aim of the project was to interface the beaglebone with the APM rover in order to impart autonomy to the vehicle. The idea was to make the beaglebone as the gateway between the remote control and the vehicle and also interface with the sensors and communicate with the Ground Control Station(GCS) to give the commands to the rover. The GCS software is called Mission Planner and it runs on Windows OS. This report contains the details about the hardware and software required and procedure to be followed to build and launch the system. HARDWARE: The basic hardware consists of a rover built to be compatible with the APM arduover software (we used the APM rover provided to us), Beagle Bone Black which forms the heart of the system, the BBB mini which is a cape on the BBB to interface with the other sensors and the Remote Control for providing the motion commands to the rover. The hardware of the BBBMini requires the following sensors: 1. MPU-9250 IMU 2. MS5611 barometer 3. 3Dr GPS 4. Wifi adapter 5. RC remote (Taranis capable of combined PWM output on one pin) When all these components are connected to the beaglebone, an external power supply is required. In this project a battery pack with usb output of 5V and 2A was used. The connections are as shown below. The output to servo and ESC has to be on RC2(servo) and RC4(throttle). You can map these on the mission planner software under full parameter list. The SOFTWARE: In order to run the entire system, we first need to flash the EEMC with the required version of Linux for BBB (in our case it is BBB debian 8.6 compiled RT-kernel) and then set up a network for it to wirelessly connect to the computer running the GCS and install the ardurover software. Note: Link for the Debian image compiled with RT https://rcn-ee.net/rootfs/bb.org/testing/2016-10-02/console/BBB-blank-debian-8.6-console-armhf- 2016-10-02-2gb.img.xz The steps are as follows: 1. Setup WIFI a) ADHOC Wifi on beaglebone First step is to create an adHoc network with ssid “myADHOC” and IP on beaglebone is 10.10.1.1 Run all commands as root or using sudo ● apt-get update ● apt-get install wireless-tools -y ● iwconfig ● Install vim if not installed : apt-get install vim -y ● Copy the name of the wireless interface : in this case “wlxc46e1f23f5fe” ● vi /etc/network/interfaces ● Add the following lines in the interfaces file auto wlxc46e1f23f5fe iface wlxc46e1f23f5fe inet static address 10.10.1.1 netmask 255.255.255.0 wireless-channel 1 wireless-essid myADHOC wireless-mode ad-hoc Description of the commands are as follows: auto wlxc46e1f23f5fe /// automatically load configuration iface wlxc46e1f23f5fe inet static /// configure statically address 10.10.1.1 // set ip as 10.10.1.1 (make sure this is not same as any in your network) netmask 255.255.255.0 // set appropriate netmask wireless-channel 1 // set channel 1-14 () wireless-essid myADHOC // name of the ADHOC network wireless-mode ad-hoc // set mode as ad-hoc (normally managed) ● ifup wlxc46e1f23f5fe ● iwconfig ● Shutdown and start beaglebone ( do not reboot ) ● Wait for the light on the adapter to turn on (wifi is up , if not login through wired and verify wireless properties) ● Wait for 1 minute after this to ensure wifi is up. ● Check in the wifi of laptop if the ssid is visible. If so the wifi is setup Troubleshooting : ● Wifi needs more power and hence if powered using laptop usb the wifi may not function as expected. Use 5V,2A source ● Ensure that the wifi interface settings in /etc/network/interfaces are indented as shown ● Ensure the interface name is correct ● Also if wifi doesn't switch on, shutdown beaglebone, disconnect and reconnect power source and reboot Useful Links https://wiki.debian.org/WiFi/AdHoc b) ADHOC wifi on Windows We will be connecting to adHoc network with ssid “myADHOC” and ip on windows should be set to 10.10.1.xxx. In our case we set the IP to 10.10.1.5 The following steps are to be followed: Go to "Network and Sharing Center" Click "Set up a new connection or network" Double click "Manually connect to a wireless network" Enter the SSID of the adhoc network (as shown by "netsh wlan show networks") into the "Network name" field In our case the ssid is “myADHOC” Configure security settings accordingly Our network is not encrypted, hence use “No authentication(open)” Uncheck "Start this connection automatically" (important) Click "Next", then "Close" Go to "Network and Sharing Center" Go to “change adapter settings” Go to the wireless card used to connect to the adhoc network and open properties by right clicking on the wifi network card. ● Double click in “Internet Protocol Version 4 (TCP/IPv4)” and set values as shown ○ Ip address: 10.10.1.5 ○ Subnet mask : 255.255.255.0 ● Click “ok” and close. ● Open cmd as administrator ● Run the following commands: netsh wlan set profileparameter myADHOC connectiontype=ibss connectionmode=manual netsh wlan connect name="myADHOC" ssid="myADHOC" interface="Wi-Fi 3" pause Here interface="Wi-Fi 3" should be set as the name of the wireless network. This is the name of the card as displayed in change adapter settings. “Wi-Fi 3” was an external adapter used during this example. In case you are using the default wi-fi adapter of your system, you need not add the interface property. ● Ping the bone to verify (IP of the BBB was set to 10.10.1.1) ● Make sure beaglebone wifi is up first ● Make sure you wait for a minute after beaglebone wifi is up before starting windows network. ● At this point you should be able to ssh into the beaglebone at ssh [email protected] Issues with wifi The image of debian flashed on the EEMC is compiled with Rt-kernel and might be missing a few packages. So when we connect the wifi adapter we can see that the adapter is not configured correctly. And connecting to a wpa-protected Wifi access point can fail. Hence ADHOC mode should be preferred with this adapter. In case one wishes to install the adapter follow the instructions below. Download all files starting with rtl8192cufw from this link https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/tree/rtlwifi Copy them to /lib/firmware/rtlwifi/ (create the directory if required) This is automatically done in the setupbeaglebone_1.sh After this we were able to connect to a unprotected wifi network. When the network is encrypted connection is not established and we get an error which mentions that the interface is not found. Hence adhoc was chosen as it didn’t have any issue. 2. Setup software for ardupilot ● Create 3 files (setupbeaglebone_1.sh, setupbeaglebone_2.sh, setupbeaglebone_3.sh) with contents as shown in Appendix in /root ● Run the following commands: (https://github.com/surajshanbhag/arduPilot_Rover) ○ chmod +x setupbeaglebone* ○ ./setupbeaglebone_1.sh ○ Sudo shutdown -r now ○ ./setupbeaglebone_2.sh ○ Sudo shutdown -r now ○ ./setupbeaglebone_3.sh ○ Sudo shutdown -r now ● If all scripts run with no errors then the beaglebone is setup to run ardupilot. ● We have to now build the ardupilot for beaglebone. It can be done on beaglebone(very slow) or on laptop as follows ( requires Ubuntu) ● We used a laptop having ubuntu as it was faster. The following steps were followed: ○ git clone https://github.com/diydrones/ardupilot.git ○ cd ardupilot ○ ./Tools/scripts/install-prereqs-ubuntu.sh ○ git checkout Copter-3.4 for ArduCopter or git checkout ArduPlane-3.7.1 for ArduPlane ○ git submodule update --init --recursive ○ alias waf="$PWD/modules/waf/waf-light" ○ waf configure --board=bbbmini ○ waf ○ scp build/bbbmini/bin/* [email protected]:/home/debian/ ● Compile examples to test the hardware ○ cd ardupilot ○ git checkout master ○ git submodule update --init --recursive ○ alias waf="$PWD/modules/waf/waf-light" ○ waf configure --board=bbbmini ○ waf examples ○ scp build/bbbmini/examples/* [email protected]:/home/debian/ This completes the setup for Ardupilot Once this done, the next step is to test the hardware connected to the BBB mini i.e. MPU-9250 10DOF IMU, MS5611 Barometer, and 3DR GPS. The following executables are to be run Testing GPS: ● Run: sudo /home/debian/GPS_AUTO_test -B /dev/ttyO5 Testing IMU: ● Run: sudo /home/debian/INS_generic ● Hit enter once after about 30 seconds. Testing Compass: Run: sudo /home/debian/AP_Compass_test These outputs confirm that the beaglebone is able to communicate to the sensors. 3) Mission Planner The next step is to connect to Mission Planner. ● Install Mission Planner from this link: http://ardupilot.org/planner/docs/common-install-mission- planner.html on the laptop which will run the GCS ● Run : /home/debian/ardurover sudo /home/debian/arducopter-quad -C udp:10.10.1.5:14550 - B /dev/ttyO5 The highlighted IP is the IP of the laptop ● Run mission Planner ● Select UDP in Click on ‘Connect’ Once you are connected you see the rover with a GPS location shown as below. We notice that the left window says “Disarmed” which means that the throttle is disabled. For the purpose of this project, the Arming check is disabled by writing Arming_Require paramter as 0(disabled). Please note that the first channel (RC1) is configured for servo and hence will be running a PWM. If the throttle or ESC is connected to this, the vehicle will move.