<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Autonomous Quadrocopter</title>
	<atom:link href="http://gdansk.bradley.edu/wp_4copter_b/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://gdansk.bradley.edu/wp_4copter_b</link>
	<description>Bradley&#039;s Lab Notebook for Senior Project by Bradley Bergerhouse, Nelson Gaske, and Austin Wenzel</description>
	<lastBuildDate>Tue, 10 Apr 2012 21:31:48 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
		<item>
		<title>April 10 &#8211; Bitbake and Xenomai</title>
		<link>http://gdansk.bradley.edu/wp_4copter_b/?p=121</link>
		<comments>http://gdansk.bradley.edu/wp_4copter_b/?p=121#comments</comments>
		<pubDate>Tue, 10 Apr 2012 21:31:48 +0000</pubDate>
		<dc:creator>bbergerhouse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://gdansk.bradley.edu/wp_4copter_b/?p=121</guid>
		<description><![CDATA[After the Xenomai image compiled using buildroot did not work, I decided to go back to the original place I had heard about Xenomai. This individual was able to compile the Linux kernel using OpenEmbedded and bitbake with a provided script and recipe. Building Image contains the information and files I used for building the [...]]]></description>
			<content:encoded><![CDATA[<p>After the Xenomai image compiled using buildroot did not work, I decided to go back to the original place I had heard about Xenomai.  <a href="http://letsmakerobots.com/node/28812" target="_blank">This individual</a> was able to compile the Linux kernel using OpenEmbedded and bitbake with a provided script and recipe.  <a href="https://www.gitorious.org/veter/pages/BuildingImage" target="_blank">Building Image</a> contains the information and files I used for building the image.</p>
<p>The process went pretty well,except at one point bitbake requires and enormous amount of resources.  I had to increase the amount of memory available to my VM from 1GB to 1.5GB.  Additionally there were a few packages that are currently out of date and need to be obtained from sources that are not the normal repositories.  These are added to the /sources folder and the MD5 and SHA256 checksums needed updating for them in their respective recipes as well.</p>
<p>After the build I decided that instead of re-imaging the SD card with he new information, I overwrote the old information with the new to save time.  The new installation worked and began a lengthy initial setup.  After the setup was completed I was greeted by an Angstrom logo and a login for the board.  Although pleased that the installation worked, there were a few problems withe the build.  The key problems are that the USB drivers and the wireless drivers do not work.  Apparently these drivers were not compiled into the kernel, or a module.  Also because of a slightly newer kernel (2.6.35 vs 2.6.32) and the installation of Xenoami, the old drivers do not work.</p>
<p>I need to reconfigure the kernel and ensure that the modules will be compiled for the proper kernel version, then redo this image.</p>
<p>I also made sure to create an image of the &#8220;working&#8221; SD card so that in any case we will have a Xenomai kernel that works.</p>
]]></content:encoded>
			<wfw:commentRss>http://gdansk.bradley.edu/wp_4copter_b/?feed=rss2&#038;p=121</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>March 22 &#8211; Xenomai</title>
		<link>http://gdansk.bradley.edu/wp_4copter_b/?p=112</link>
		<comments>http://gdansk.bradley.edu/wp_4copter_b/?p=112#comments</comments>
		<pubDate>Mon, 26 Mar 2012 21:20:47 +0000</pubDate>
		<dc:creator>bbergerhouse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://gdansk.bradley.edu/wp_4copter_b/?p=112</guid>
		<description><![CDATA[I was able to complete the compilation of a Linux kernel patched with Xenomai recently using a config file attached below. Also attached below is my code so far for PWM generation on the Beagleboard xM. I believe this version of the code is &#8220;working&#8221; but I am not 100% sure if this is the [...]]]></description>
			<content:encoded><![CDATA[<p>I was able to complete the compilation of a Linux kernel patched with Xenomai recently using a config file attached below.  Also attached below is my code so far for PWM generation on the Beagleboard xM.  I believe this version of the code is &#8220;working&#8221; but I am not 100% sure if this is the correct revision.</p>
<p>After the compilation of the new Xenomai kernel was completed I imaged the SD card with the relevant files.  I ran into some trouble however with actually making the kernel boot and run.</p>
<p>Buildroot does not compile the first stage bootloader MLO so I had to pull that file off the boot partition of another SD card.  The initial u-boot.bin that was compiled did not work, for unknown reasons so that was also taken from a second SD card.</p>
<p>Once writing all the necessary files, I was greeted by the MLO loading U-Boot which proceeded to load and decompress the kernel.  Then nothing.  The kernel &#8220;finished&#8221; decompressing and the bootloader indicated that the kernel was being given control.  Following this statement no further output appeared on the terminal.</p>
<p>Today (March 26) I stumbled upon a general emulator with Beagleboard capabilities.  I plan to spend sometime setting this up and testing various images with different build settings.</p>
]]></content:encoded>
			<wfw:commentRss>http://gdansk.bradley.edu/wp_4copter_b/?feed=rss2&#038;p=112</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>March 8 &#8211; Continued PWM and Xenomai</title>
		<link>http://gdansk.bradley.edu/wp_4copter_b/?p=100</link>
		<comments>http://gdansk.bradley.edu/wp_4copter_b/?p=100#comments</comments>
		<pubDate>Thu, 08 Mar 2012 22:47:01 +0000</pubDate>
		<dc:creator>bbergerhouse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://gdansk.bradley.edu/wp_4copter_b/?p=100</guid>
		<description><![CDATA[Today I found a project called Xenomai which aims to provide a &#8220;real-time development framework cooperating with the Linux kernel&#8221;. I found this after stumbling upon a project controlling a servo using the Beagleboard xM GPIO pins. AndreyNech of letsmakerobots.com had a problem similar to ours with shaky waveform outputs. In his blog post he [...]]]></description>
			<content:encoded><![CDATA[<p>Today I found a project called <a href="http://www.xenomai.org/index.php/Main_Page" target="_blank">Xenomai</a> which aims to provide a &#8220;real-time development framework cooperating with the Linux kernel&#8221;. I found this after stumbling upon a project controlling a servo using the Beagleboard xM GPIO pins. <a href="http://letsmakerobots.com/blog/16153" target="_blank">AndreyNech</a> of <a href="http://letsmakerobots.com" target="_blank">letsmakerobots.com</a> had a problem similar to ours with shaky waveform outputs.</p>
<p>In his blog post he mentions two areas that create instability in the waveform. The first area is kernel context switches which delays the overall reaction time by a fairly predictable amount. The solution, which I have been looking at for a week or so as well, is to memory map the IO registers and manipulate them manually. Below is some code I wrote to facilitate this:</p>
<pre> md = open("/dev/mem", O_RDWR | O_SYNC);
volatile ulong *gpio;
gpio = (ulong*) mmap(NULL, 0x10000, PROT_READ | PROT_WRITE, MAP_SHARED, md, 0x49050000);
if(gpio == MAP_FAILED)
puts("Map Failure.");
close(md);</pre>
<p>mmap is used to create a virtual map from the array gpio to the information pointed to by md.  The last value is an offset which bases gpio[0] at md [0x49050000].  This value can be found in the <a href="http://www.ti.com/lit/ug/spruf98v/spruf98v.pdf" target="_blank">OMAP 35xx Applications Processor Technical Reference Manual</a> on page 3400.  0&#215;49050000 is the base address for the GPIO Module 2.  From this number each additional GPIO Module is indexed at +0&#215;2000 from the previous module.  Within each register segment are a number of registers which control the actions of a particular pin.</p>
<p>We are interested in GPIO_CLEARDATAOUT and GPIO_SETDATAOUT for the control of the PWM pulses.  These two registers are offset at 0&#215;0090 and 0&#215;0094 respectively.  Since the pins we are using are attached to Module 5 we will be  be using an offset of 0&#215;6000 for the module which results in a net offset of 0&#215;6090 and 0&#215;6094 for the CLEAR and SET.  According to the documentation (also in the Reference Manual) these registers directly map to the pins in numerical order.  When I tried to test this however I somehow blocked any input from the keyboard.</p>
<p>The second source of timing error mentioned in the blog above is from the fact that the linux kernel is not a realtime kernel by default.  This means that when performing timing specific functions like waiting, there is no guarantee that the timing will be accurate.  The sleep and nanosleep functions we would normally use the wait are not actually accurate timings.  Xenomai is discussed as a realtime framework that runs as a sort of hypervisor for the linux kernel.  I was originally trying to build Xenomai with the kernel manually, but the source files never matched up properly.  <a href="http://buildroot.uclibc.org/" target="_blank">Buildroot</a> has been <a href="http://blog.galemin.com/2011/06/buildroot-2011-05-all-in-one-for-beagleboard-xm/" target="_blank">configured</a> to work on the Beagleboard xM.  Dr. Malinowski noticed that Buildroot includes an option for compiling Xenomai into the kernel automatically.</p>
<p>I have since begun the process of compiling the kernel using bultroot.</p>
<p>Sites:</p>
<p>http://x4350.blogspot.com/2011/01/digital-io-on-beagleboard-using-gpio.html</p>
<p>http://41j.com/blog/2011/09/beagleboard-gpio-input-driverless/</p>
<p>http://blog.galemin.com/2011/06/buildroot-2011-05-all-in-one-for-beagleboard-xm/</p>
<p>http://www.ti.com/lit/ug/spruf98v/spruf98v.pdf</p>
<p>http://buildroot.uclibc.org/</p>
]]></content:encoded>
			<wfw:commentRss>http://gdansk.bradley.edu/wp_4copter_b/?feed=rss2&#038;p=100</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>February 16 &#8211; 26, 2012 &#8211; PWM and Design Review Update</title>
		<link>http://gdansk.bradley.edu/wp_4copter_b/?p=95</link>
		<comments>http://gdansk.bradley.edu/wp_4copter_b/?p=95#comments</comments>
		<pubDate>Mon, 27 Feb 2012 01:23:15 +0000</pubDate>
		<dc:creator>bbergerhouse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://gdansk.bradley.edu/wp_4copter_b/?p=95</guid>
		<description><![CDATA[Past few weeks have been interesting. Me and Nelson have been working fervently on a PWM solution for the Beagleboard. Austin continues his adventure into the lands of DSP where he continually loses his towel. Then this past Thursday we had a presentation about the status and schedule of the project. The industry standard protocol [...]]]></description>
			<content:encoded><![CDATA[<p>Past few weeks have been interesting.  Me and Nelson have been working fervently on a PWM solution for the Beagleboard.  Austin continues his adventure into the lands of DSP where he continually loses his towel.  Then this past Thursday we had a presentation about the status and schedule of the project.</p>
<p>The industry standard protocol for communicating with servos is a form of PWM.  The RC industry uses this PWM signal to communicate information between the receiver and servo driving hardware.  The RC signal is actually a pulse repeated every 20ms with a &#8220;high time&#8221; of 1-2ms with the median value at 1.5ms.  The 1ms and 2ms times represent -100% and 100% position (ala a joystick) on that particular channel.  Our final PWM solution will require a number of divisions on each side of the 0% mark to accurately control the copter.  As an initial benchmark point we are looking to implement at least 10% increments in the pulse.  This would require 21 different &#8220;positions&#8221; (-100%, -90%,&#8230;, 0,&#8230;, 100%), ten each for positive/negative and one for 0%.  This requires timing precision to the 40th of a millisecond or 25 microseconds.</p>
<p>I have been piecing together some code to implement a PWM signal from userspace.  The code will be attached in the next entry.  I borrowed the concept of a multi-threaded program and code foundation from here: <a href="http://thoughtshubham.blogspot.com/2010/04/pwm-generation-in-beagleboard.html" target="_blank">PWM Generation in Beagleboard</a>.  The idea is to spawn a new thread for each necessary PWM channel and passing the thread a pointer to a structure containing timing information.  Upon start the thread opens the gpio device file in &#8220;/sys/class/gpio###/value&#8221; where ### is the GPIO pin number.  After the file is opened a cycle of changing the pin value and sleeping creates a PWM signal on the pin.</p>
<p>My modifications include creating 5 PWM threads and relevant structures, adding a sleep to main() replacing the spinlock (which actually doesn&#8217;t even look for a lock), modified the PWM thread function to include runtime channel setting and disabling the output buffer by using open() instead of fopen().  I also expanded the PWM structure to include a pin number so that the thread function will be able to allocate the pin at runtime.  I currently maintain a bash script to open all the pins for writing, and closing them later but I plan to integrate this functionality into the main code this week.</p>
<p>I was also able to test my program, but found that the frequency and duty cycle were far too variable.  I will likely need to run the process in a higher priority or make it into a kernel driver for PWM.  This week I will also be mapping out 5 pins to use for PWM by manually testing my program on each possible pin until 5 of them work.</p>
<p>Nelson has been working on compiling a module called <a href="https://github.com/tallakt/servodrive" target="_blank">Servodrive</a> which is a kernel driver specifically created for RC pulse generation on the Beagleboard.  The Servodrive module is built using Open Embedded and Bitbake.  Bitbake is a system which automates the process of creating an embedded Linux distribution including building toolchains, cross-compiling, and file systems.  Bitbake is also about as well documented as my toenails.  Nelson has more information on the &#8220;process&#8221; of bitbaking in his blog posts.</p>
<p>The presentation this week was interesting.  We basically had to give a presentation to Professors Anakwa, Dempsey, Sanchez and Malinowski indicating the progress of the project and any revisions to the goals.  The gist of our presentation is that we are behind a decent amount due to various reasons among which lack of documentation features prominently.  The Beagleboard xM documentation is often cryptic, useless and flatout wrong.  Major pin headers in the manual for our revision are incorrectly labeled and oriented, and some pins do not map where they are &#8220;supposed&#8221; to.  We decided to revise our goals a bit to finish with a fly-by-wire system that uses on-board sensors to prevent the vehicle from colliding with obstacles.  The camera and DSP material will be used to enhance the operation of the vehicle in some manner which has not really been pinned down yet.</p>
]]></content:encoded>
			<wfw:commentRss>http://gdansk.bradley.edu/wp_4copter_b/?feed=rss2&#038;p=95</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>February 7 &#8211; 15, 2012 &#8211; Kernel Compile, Assorted</title>
		<link>http://gdansk.bradley.edu/wp_4copter_b/?p=88</link>
		<comments>http://gdansk.bradley.edu/wp_4copter_b/?p=88#comments</comments>
		<pubDate>Wed, 15 Feb 2012 21:14:13 +0000</pubDate>
		<dc:creator>bbergerhouse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://gdansk.bradley.edu/wp_4copter_b/?p=88</guid>
		<description><![CDATA[Last few lab days have felt fairly uneventful. We finished soldering the power supply together for all the +5V electronics and tested the device to ensure a stable output. Additionally we added the propellers to the copter so that we can begin flying the vehicle around, once rotor guards are figured out. Last week we [...]]]></description>
			<content:encoded><![CDATA[<p>Last few lab days have felt fairly uneventful.  We finished soldering the power supply together for all the +5V electronics and tested the device to ensure a stable output.  Additionally we added the propellers to the copter so that we can begin flying the vehicle around, once rotor guards are figured out.  </p>
<p>Last week we determined that we would need to recompile the Linux kernel and U-Boot to properly modify the multiplexer settings.  We are using a Linux Kernel 3.0.0 RC2 codebase with the DSP Bridge kernel driver code included.  Also installed were the ncurses header files for menuconfig.  The codebase can be obtained from git:</p>
<pre>git clone git://dev.omapzoom.org/pub/scm/tidspbridge/kernel-dspbridge.git</pre>
<p>Basic compilation process works like this:</p>
<pre>
make distclean
make ARCH=arm omap2plus_defconfig
make ARCH=arm menuconfig
make ARCH=arm CROSS_COMPILE=~/armgnu/arm-none-linux-gnueabi- uImage
make ARCH=arm CROSS_COMPILE=~/armgnu/arm-none-linux-gnueabi- modules
</pre>
<p>Line 1 cleans the source directories of all the generated object and configuration files, as well as final outputs.<br />
Lines 2 and 3 setup the build configuration file which will determine which kernel features will be compiled in the final image.  During the menuconfig step we need to enable the DSP Bridge Driver which is found under Device Drivers -> Staging Drivers -> DSP Bridge Driver.  Note that Staging Drivers needs to be enabled and Exclude Staging Drivers From Being Built needs to be disabled.<br />
Lines 4 and 5 compile the kernel image and any necessary kernel modules.  The CROSS_COMPILE options indicates the location of the proper cross compiler.  I chose to link a folder in my home directory (armgnu) to the bin folder for Code Sourcery.  arm-gnu-none-linux-gnueabi- is a prefix attached to gcc and related binaries to indicate the proper cross compiler.</p>
<p>The above obviously builds ONLY the kernel image and modules and not any supporting programs and utilities.  </p>
<p>On Tuesday the 14th Nelson started recompiling the Angstrom distribution on my laptop using Open Embedded.  The process took a very long time, at least 6 hours.  During this time I worked on finding a way to access the GPIO pins without modifying the kernel image.  As it turns out the GPIO is abstracted into a file just like every other device.  By writing single values of 1 or 0 to the proper file (one per pin) the state can be toggled.  Currently I am writing some test code to determine exactly which pins will be usable on the expansion header for PWM.  Once the pins have been determined I will be testing the timing precision available in the nanosleep() system function and delays inherent in accessing the pins through the OS.  If no changes are required we will be able to use the foundation code as the framework for our end project.  Code will be posted in a file on Thursday if completed.</p>
]]></content:encoded>
			<wfw:commentRss>http://gdansk.bradley.edu/wp_4copter_b/?feed=rss2&#038;p=88</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>January 24, 2012 &#8211; Completed Assembly</title>
		<link>http://gdansk.bradley.edu/wp_4copter_b/?p=84</link>
		<comments>http://gdansk.bradley.edu/wp_4copter_b/?p=84#comments</comments>
		<pubDate>Wed, 25 Jan 2012 02:10:57 +0000</pubDate>
		<dc:creator>bbergerhouse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://gdansk.bradley.edu/wp_4copter_b/?p=84</guid>
		<description><![CDATA[We decided to come in today after lunch to complete the assembly and do some preliminary testing on the platform&#8217;s power requirements. The majority of the assembly today was connecting the electrical components and the landing tubes. The motor Electronic Speed Controllers (ESCs) have both power and signal plugs. The ESC power plugs are attached [...]]]></description>
			<content:encoded><![CDATA[<p>We decided to come in today after lunch to complete the assembly and do some preliminary testing on the platform&#8217;s power requirements.  The majority of the assembly today was connecting the electrical components and the landing tubes.  The motor Electronic Speed Controllers (ESCs) have both power and signal plugs.  The ESC power plugs are attached to an octopus style power distribution cable which attaches to the battery.  The signal plugs then all attached to the Flight Control Unit (FCU) which use a proprietary PWM to interface with the ESCs.</p>
<p>The battery to power the system will be strapped to the bottom of the copter using a provided Velcro strap and fastening.  The sensor unit containing gyros and accelerometers is mounted on top of the copter.  We are thinking of mounting the BeagleBoard upside-down under the copter to both provide clearance for the camera and to correct for the camera&#8217;s flipped image.</p>
<p>Preliminary testing showed that the copter platform uses a minimum of 1.6A at 11.1V when the motors are activated at the minimum speed setting.  We have not tested the copter with the propellers yet.  The BeagleBoard has a current draw of 1.3A at 5V with the HDMI connected monitor and wireless dongle.  Removing the monitor sees a reduction of about .05A and removing the wireless dongle sees a reduction of .2A.  For the purposes of creating a suitable supply to convert 11.1V to 5V we will say the BeagleBoard draws 1.5A at 5V.  Other electronics on the 5V power rail are the 6 IR sensors and the 8-channel ADC module.</p>
<p>We will be using a switching power supply created for Dr. Malinowski&#8217;s robots to convert our battery voltage into 5V.  We will however need to spend some time to redo the soldering on the board to minimize the weight and reduce any sensitivity to vibration.  The board currently outputs a maximum of 3A at 4.8V.  The BeagleBoard accepts a supply anywhere from 4.8V to 5.2V so we will be adjusting the resistor feedback path to bump the voltage up a little to 5V to ensure we do not drop below the 4.8V threshold under load.</p>
<p>Today we submitted a number of parts to be ordered so that the power supply can be completed for further testing:</p>
<p><a href="http://www.amainhobbies.com/product_info.php/cPath/1389_1393_1858/products_id/209254/n/Thunder-Power-Pro-Lite-G6-3S-Li-Poly-Battery-25C-111V-5000mAh" target="_blank">AmainHobbies Thunder Power Pro Lite &#8220;G6&#8243; 3S Li-Poly Battery 25C (11.1V/5000mAh)</a><br />
<a href="http://www.amainhobbies.com/product_info.php/cPath/1389_226/products_id/3598/n/Deans-Female-Ultra-Plug-2" target="_blank">AmainHobbies Deans Female Ultra Plug</a><br />
<a href="http://www.amainhobbies.com/product_info.php/cPath/1574_1289/products_id/26724/n/Bantam-E-Station-Balancing-Adapter-Board-Thunder-Power" target="_blank">AmainHobbies Bantam E-Station Balancing Adapter Board (Thunder Power)<br />
</a><a href="http://www.amainhobbies.com/product_info.php/cPath/1574_654/products_id/16845/n/ProTek-R-C-Heavy-Duty-14awg-Ultra-Plug-Charge-Lead-Male-Plug-to-4mm-Banana-Plugs" target="_blank">AmainHobbies ProTek R/C Heavy Duty (14awg) Ultra Plug Charge Lead (Male Plug to 4mm Banana Plugs)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://gdansk.bradley.edu/wp_4copter_b/?feed=rss2&#038;p=84</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>January 19, 2012 &#8211; I2C and Platform Assembly</title>
		<link>http://gdansk.bradley.edu/wp_4copter_b/?p=79</link>
		<comments>http://gdansk.bradley.edu/wp_4copter_b/?p=79#comments</comments>
		<pubDate>Sun, 22 Jan 2012 22:08:24 +0000</pubDate>
		<dc:creator>bbergerhouse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://gdansk.bradley.edu/wp_4copter_b/?p=79</guid>
		<description><![CDATA[The BeagleBoard xM comes equipped with 3 I2C buses which can be used with I2C devices.  Our ranging sensors have an analog output between 0 and +5 Volts.  Because we have 6 of these sensors we are using an 8 channel A/D converter that communicates over I2C. The ADC board uses 5V logic while the [...]]]></description>
			<content:encoded><![CDATA[<p>The BeagleBoard xM comes equipped with 3 I2C buses which can be used with I2C devices.  Our ranging sensors have an analog output between 0 and +5 Volts.  Because we have 6 of these sensors we are using an 8 channel A/D converter that communicates over I2C.</p>
<p>The ADC board uses 5V logic while the BeagleBoard uses 1.8V logic.  The ADC board will be connected to the BeagleBoard via a logic level converter.  We spent some time finding the pinout for the SDA and SDL pins on the board.  The manuals have not been updated for our revision so the header is labeled improperly, but we were able to find the pin position on the board.  Next week we plan to connect the I2C output bus to Nelson&#8217;s logic analyzer and run tests to ensure we can communicate properly with the I2C bus.</p>
<p>&nbsp;</p>
<p>The afternoon we assembled the quadrocopter platform.  The assembly went smoothly until the end when we discovered we were missing a piece  which mounts the flight controller.  This is annoying, but we have already come up with a few ways to mount the controller without this backing panel.  A timelapse of the build can be watched on Youtube here:<br />
<object width="560" height="315"><param name="movie" value="http://www.youtube.com/v/BchgAChTpfc?version=3&amp;hl=en_US&amp;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/BchgAChTpfc?version=3&amp;hl=en_US&amp;rel=0" type="application/x-shockwave-flash" width="560" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://gdansk.bradley.edu/wp_4copter_b/?feed=rss2&#038;p=79</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Camera Drivers and Video Output</title>
		<link>http://gdansk.bradley.edu/wp_4copter_b/?p=76</link>
		<comments>http://gdansk.bradley.edu/wp_4copter_b/?p=76#comments</comments>
		<pubDate>Thu, 01 Dec 2011 22:27:08 +0000</pubDate>
		<dc:creator>bbergerhouse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://gdansk.bradley.edu/wp_4copter_b/?p=76</guid>
		<description><![CDATA[The Leopard Imaging LBCM5M1 Camera Module uses the MT9P011 CMOS imaging sensor produced by Aptina to capture images.  I found a blog entry indicating that the driver for the MT9P031 is compatible with the MT9P011 sensor.  This driver is available in the Angstrom repositories as a kernel object file.  I installed and registered this file [...]]]></description>
			<content:encoded><![CDATA[<p>The <a title="Leopard Imaging" href="https://www.leopardimaging.com/" target="_blank">Leopard Imaging</a> <a title="LBCM5M1" href="https://www.leopardimaging.com/uploads/LI_LBCM5M1_Camera_Board.pdf" target="_blank">LBCM5M1 Camera Module</a> uses the <a title="MT9P011" href="http://www.google.com/url?sa=t&amp;rct=j&amp;q=mt9p011&amp;source=web&amp;cd=1&amp;ved=0CB0QFjAA&amp;url=http%3A%2F%2Fwww.aptina.com%2Fassets%2FdownloadDocument.do%3Fid%3D177&amp;ei=dfXXTpmeOsec2AXd4u2xDg&amp;usg=AFQjCNGQU280AZZeXEUVnloBgV1P3Xr3FQ&amp;cad=rja" target="_blank">MT9P011</a> CMOS imaging sensor produced by <a title="Aptina Imaging" href="http://www.aptina.com/" target="_blank">Aptina</a> to capture images.  I found a <a title="Camera on Beagleboard" href="http://blog.galemin.com/2011/04/li-5m03-camera-on-beagleboard-xm/" target="_blank">blog</a> entry indicating that the driver for the MT9P031 is compatible with the MT9P011 sensor.  This driver is available in the Angstrom repositories as a kernel object file.  I installed and registered this file from the repository this morning.</p>
<p>sudo opkg install kernel-module-mt9p031<br />
sudo modprobe -v mt9p031</p>
<p>Additionally the uEnv.txt file on the boot partition needed a line added for the camera.  This tells the kernel that a driver needs to be loaded for the camera.  The line was added at the end of the file, but I believe that the line can be added anywhere.</p>
<p>camera=lbcm5m03</p>
<p>After a quick system reboot the camera is loaded automatically.</p>
<p>We used the mplayer application to pull and display the images from the camera.</p>
<p>mplayer tv:// -tv width=640:height=480:device=/dev/video0:fps=10 -vo x11</p>
<p>&nbsp;</p>
<p>Today we were made aware of an alternative model of the XAirCraft X650 platform.  The new XAirCraft X650 Value platform is available in lieu of the original carbon fiber platform which was sold out.  The new platform uses different motors, a modified ESC system and plastic booms.  These features make this platform comparable to the original X650 in terms of utility.  We have given the go ahead to have this model procured.</p>
]]></content:encoded>
			<wfw:commentRss>http://gdansk.bradley.edu/wp_4copter_b/?feed=rss2&#038;p=76</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>November 17, 2011 &#8211; Joystick Fun</title>
		<link>http://gdansk.bradley.edu/wp_4copter_b/?p=52</link>
		<comments>http://gdansk.bradley.edu/wp_4copter_b/?p=52#comments</comments>
		<pubDate>Mon, 21 Nov 2011 04:21:04 +0000</pubDate>
		<dc:creator>bbergerhouse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://gdansk.bradley.edu/wp_4copter_b/?p=52</guid>
		<description><![CDATA[Late update for November 17, 2011 Thursday I spent the morning working on some interface code for the Logitech Wingman joystick that we will be using for the backup fly-by-wire controls in the project. The code itself is based off a code template provided as part of my Real Time Operating Systems course for communicating [...]]]></description>
			<content:encoded><![CDATA[<p>Late update for November 17, 2011</p>
<p>Thursday I spent the morning working on some interface code for the Logitech Wingman joystick that we will be using for the backup fly-by-wire controls in the project. The code itself is based off a code template provided as part of my Real Time Operating Systems course for communicating joystick information over a serial port.</p>
<p>As a test I decided to simulate mouse movements using the joystick. The X and Y positions correspond to X and Y mouse movements while the Z axis changes the speed at which the mouse pointer moves. The trigger sends a left click to Windows. The code is platform specific. Relevant code is below:</p>
<pre>
//* Example illustrating Joystick access in Windows *
#include &lt;windows.h&gt;
#include &lt;limits.h&gt;
#include &lt;Winuser.h&gt;
#include &lt;Wtsapi32.h&gt;
// We need winmm.h but it needs some more of windows.h
// Add to the linked libraries list: winmm.lib

// We need to print debug information in this particular example
#include &lt;stdio.h&gt;

int main()
{
POINT pt; // cursor location
static int repeat = 1; // repeat key counter
short keeprunning = 1;
bool button = false;
int speed;
INPUT Input = {0};

while (keeprunning)
{
JOYCAPS jc; // to keep features of the joystick
JOYINFOEX lastJoyState; // to keep joystick state

if (joyGetNumDevs()==0)
{
fprintf(stderr, "Please connect a joystick\n");
Sleep(5000);
continue;
}

if (joyGetDevCaps(JOYSTICKID1, &amp;jc, sizeof(jc))!=JOYERR_NOERROR)
{
fprintf(stderr, "Please connect a compatible joystick\n");
Sleep(1000);
continue;
}

lastJoyState.dwSize=sizeof(lastJoyState);
lastJoyState.dwFlags=JOY_RETURNALL | JOY_RETURNPOVCTS | JOY_RETURNCENTERED | JOY_USEDEADZONE;

{
const unsigned int naxes = jc.wNumAxes;
const unsigned int nbuts = jc.wNumButtons;
const int MID_VALUE =(int)(USHRT_MAX/2);

int cur_b = 0;
int cur_x = 0;
int cur_y = 0;
int cur_z = 0;

int old_b = 0;
int old_x = 0;
int old_y = 0;
int old_z = 0;

while(keeprunning)
{
if (joyGetPosEx(JOYSTICKID1, &amp;lastJoyState) != JOYERR_NOERROR)
{
fprintf(stderr, "Please reconnect the joystick\n");
Sleep(1000);
break; // exit to the outer loop and check for a new joystick connection
}

old_b = cur_b;
old_x = cur_x;
old_y = cur_y;
old_z = cur_z;

cur_b = lastJoyState.dwButtons;
cur_x = (int)(lastJoyState.dwXpos)-MID_VALUE;
cur_y = (int)(lastJoyState.dwYpos)-MID_VALUE;
cur_z = (int)(lastJoyState.dwZpos)-MID_VALUE;

speed = (cur_z + MID_VALUE) / 16;
if(speed == 0) {++speed;}
GetCursorPos(&amp;pt);
pt.x += (cur_x / speed);
if(cur_y &gt; 2000 || cur_y &lt; -3000)
pt.y += (cur_y / speed);
SetCursorPos(pt.x, pt.y);
Sleep(50);
if((cur_b &amp; 0x001) != button) {
button = (cur_b &amp; 0x001);
::ZeroMemory(&amp;Input,sizeof(INPUT));
Input.type = INPUT_MOUSE;
if(button)
Input.mi.dwFlags = 0x02;
else
Input.mi.dwFlags = 0x04;
::SendInput(1,&amp;Input,sizeof(INPUT));
}

if (cur_b==15)
{
fprintf(stdout, "End program button sequence initiated\n");
keeprunning=0;
}
}

Sleep(10); // wait 10ms between checks for the next sample
}
}

return(0);
}</pre>
<p>Edit:  Blog is stripping preceding tabs and spaces from the code.  If you need the formatting copy and paste this into Visual Studio, highlight everything and press CTRL + K + F to auto format.</p>
<p>Lab time from the afternoon was spent working on the official project proposal. The rough draft was due in to Dr. Malinowski on Friday.</p>
]]></content:encoded>
			<wfw:commentRss>http://gdansk.bradley.edu/wp_4copter_b/?feed=rss2&#038;p=52</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wireless Networking and Presentation</title>
		<link>http://gdansk.bradley.edu/wp_4copter_b/?p=23</link>
		<comments>http://gdansk.bradley.edu/wp_4copter_b/?p=23#comments</comments>
		<pubDate>Fri, 11 Nov 2011 01:09:27 +0000</pubDate>
		<dc:creator>bbergerhouse</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://gdansk.bradley.edu/wp_4copter_b/?p=23</guid>
		<description><![CDATA[This morning I spent time to setup the wireless adapter so that we could use opkg to update packages and begin working on wireless communications in following weeks. The department ordered three 802.11g wireless adapters by Belkin which came in recently.  The adapters have been numbered 1, 2 and 3 to distinguish between them in [...]]]></description>
			<content:encoded><![CDATA[<p><!-- Include required JS files --><br />
<script type="text/javascript" src="js/shCore.js"></script></p>
<p><!--<br />
    At least one brush, here we choose BASH. You need to include a brush for every<br />
    language you want to highlight<br />
--><br />
<script type="text/javascript" src="css/shBrushBash.js"></script></p>
<p><!-- Include *at least* the core style and default theme --></p>
<link href="css/shCore.css" rel="stylesheet" type="text/css" />
<link href="css/shThemeDefault.css" rel="stylesheet" type="text/css" />
<p>This morning I spent time to setup the wireless adapter so that we could use opkg to update packages and begin working on wireless communications in following weeks.</p>
<p>The department ordered three <a title="Wireless" href="http://www.belkin.com/IWCatProductPage.process?Product_Id=179211" target="_blank">802.11g wireless adapters by Belkin</a> which came in recently.  The adapters have been numbered 1, 2 and 3 to distinguish between them in the event of failure.  This is actually convenient because adapter number 3 uses a slightly different chipset than 1 and 2.  Also each adapter was registered to the Bradley University network by Mr. Mattus.</p>
<p>The method for activating wireless is fairly simple.  First the network adapter (wlan0 or wlan1 in my case) is taken down and the adapter is given an essid to connect to.  Next the adapter is brought back online and the DHCP client is activated.  The iwconfig command is used to determine whether wlan0 or wlan1 is to be used as the two different chipsets are given different numbers.  wlan# is the device to be used.</p>
<pre>
iwconfig

ifconfig wlan# down
iwconfig wlan# essid BUother
ifconfig wlan# up
dhclient wlan#
</pre>
<p>Once wireless was working we gave our project proposal presentation which lasted about an hour.  We got some good feedback on things that we need to take into account for our project and hope to have some specifics in a week or so.  After the presentation I worked on automating the process of activating wireless so that a script to perform this action on startup.</p>
<p>The first step was to use iwconfig and grep to find the adapter to be used, and store that in a variable.  The rest of the process is identical except a variable is used in place of the wlan#.  This script is then added to the init process by the update-rc.d command.</p>
<pre>
#!/bin/sh
val=$(iwconfig | grep -o ^wlan.)
ifconfig $val down
iwconfig $val essid BUother
ifconfig $val up
dhclient $val
</pre>
<pre>
update-rc.d wireless.sh defaults 51
</pre>
<p>The update command parameter of 51 makes the script run after the DHCP and usb drivers are initialized.  defaults places the symbolic links in the default locations.</p>
<p>Last item of importance for the day was to install the TIC6x compiler and toolchain for Austin to work with the DSP core.  Simple install since wireless is working.</p>
<pre>
opkg install ti-c6accel
opkg install ti-c6accel-apps
opkg install ti-c6accel-dbg
opkg install ti-c6accel-dev
</pre>
<p><script type="text/javascript">
     SyntaxHighlighter.all()
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://gdansk.bradley.edu/wp_4copter_b/?feed=rss2&#038;p=23</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
