<?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>Likely to be Forgotten</title>
	<atom:link href="http://www.abarry.org/likelytobeforgotten/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.abarry.org/likelytobeforgotten</link>
	<description>// useful code, nothing more</description>
	<lastBuildDate>Sat, 19 May 2012 00:50:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>The Complete Guide to Embedded Videos in Beamer under Linux</title>
		<link>http://www.abarry.org/likelytobeforgotten/?p=61</link>
		<comments>http://www.abarry.org/likelytobeforgotten/?p=61#comments</comments>
		<pubDate>Sat, 19 May 2012 00:46:33 +0000</pubDate>
		<dc:creator>abarry</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.abarry.org/likelytobeforgotten/?p=61</guid>
		<description><![CDATA[It is now possible to embed videos in Beamer presentations under Linux.  It&#8217;s stable and works well. The strategy is to use acroread and a flash player to play .flv files. Credit to this post for a lot of this work. Here&#8217;s how to do it: The short version: 1. Get acroread version 9.4.1 [local [...]]]></description>
			<content:encoded><![CDATA[<p>It is now possible to embed videos in Beamer presentations under Linux.  It&#8217;s stable and works well.<br />
<br />
The strategy is to use acroread and a flash player to play .flv files.  Credit to <a href="http://eumenidae.blogspot.com/2012/03/movie-playback-in-latexbeamer-current.html">this post</a> for a lot of this work.  Here&#8217;s how to do it:</p>
<p><strong>The short version:<br />
1. Get <a href="ftp://ftp.adobe.com/pub/adobe/reader/unix/9.x/9.4.1/enu/AdbeRdr9.4.1-1_i486linux_enu.bin">acroread version 9.4.1</a> [<a href="files/AdbeRdr9.4.1-1_i486linux_enu.bin">local mirror</a>]<br />
2. Download <a href="files/flashmovies-tex.zip">the example</a>.<br />
3. Convert your video to flv (mess with the resolution to get smooth playback).</p>
<pre class="brush: bash">
ffmpeg -i movie.avi -sameq -s 960x540 movie.flv
</pre>
<p></strong></p>
<p>Now the explanation:</p>
<hr />
<h4>I. Get the right version of acroread.</h4>
<hr />
<strong>1.</strong> Uninstall acroread using apt-get (which isn&#8217;t likely to be the right version)</p>
<pre class="brush: bash">
sudo apt-get remove acroread
</pre>
<p><strong>2.</strong> Download <a href="ftp://ftp.adobe.com/pub/adobe/reader/unix/9.x/9.4.1/enu/AdbeRdr9.4.1-1_i486linux_enu.bin">version 9.4.1 of acroread</a> from Adobe (note that the i486 version will still work on 64-bit systems) [<a href="ftp://ftp.adobe.com/pub/adobe/reader/unix/9.x/9.4.1/enu/">FTP page</a>] [<a href="files/AdbeRdr9.4.1-1_i486linux_enu.bin">local mirror</a>]<br />
<strong>3.</strong> Mark the package executable:</p>
<pre class="brush: bash">
cd your-download-directory
chmod +xx AdbeRdr9.4.1-1_i486linux_enu.bin
</pre>
<p><strong>4.</strong> Install acroread:</p>
<pre class="brush: bash">
./AdbeRdr9.4.1-1_i486linux_enu.bin
</pre>
<p>I installed to /opt/acroread, so I run it like so:</p>
<pre class="brush: bash">
/opt/acroread/Adobe/Reader9/bin/acroread
</pre>
<hr />
<h4>II. Get Beamer files and flash player</h4>
<hr />
<span id="more-61"></span><br />
Credit goes to <a href="http://pages.uoregon.edu/noeckel/PDFmovie.html">Jens Nöckel&#8217;s post</a> for figuring this out.</p>
<p><strong>1.</strong> Download the <a href="http://mirror.ctan.org/macros/latex/contrib/flashmovie.zip">beamer/flash player package</a> [<a href="files/flashmovie.zip">local mirror</a>]<br />
<strong>2.</strong> Extract them all to the same directory as your .tex file (<strong>not</strong> in a /flashmovie/ subdirectory)</p>
<hr />
<h4>III. Convert your movies to .flv</h4>
<hr />
<strong>1.</strong> Get ffmpeg</p>
<pre class="brush: bash">
sudo apt-get install ffmpeg
</pre>
<p><strong>2.</strong> Convert your movie to a .flv:<br />
<strong>Note</strong>: You might have to resize your movie if the resolution is high to get <strong>smooth playback</strong>.  You can do this with the -s flag as below.</p>
<pre class="brush: bash">
ffmpeg -i movie.avi -sameq -s 960x540 movie.flv
</pre>
<hr />
<h4>IV: Add the movie to your beamer slideshow</h4>
<hr />
<strong>1.</strong> Add the package to the <strong>very first line</strong> of your .tex</p>
<pre class="brush: plain">
\RequirePackage{flashmovie}
% it is necessary to use "\RequirePackage{flashmovie}" because beamer
% also uses "\pdfminorversion". see flashmovie.sty for an explanation.
</pre>
<p><strong>2.</strong> Embed the movie</p>
<pre class="brush: plain">
\frame[plain]
{
    ...stuff...
    \flashmovie[engine=flv-player,auto=1,controlbar=0]{movie.flv}
    ...stuff...
}
</pre>
<hr />
<h4>V: Changing the background color / removing controls</h4>
<p>I wanted to use black backgrounds and remove the control bar so I changed line <strong>580</strong> of flashmovie.sty to:</p>
<pre class="brush:plain">
/FlashVars (flv=#2&#038;margin=0&#038;showvolume=1&#038;showstop=1&#038;showtime=1
    &#038;showplayer=never&#038;videobgcolor=0x000000\flashmovieautovari
    \flashmovieimagevari\flashmovieloopvari)

(note this was line wrapped and should be one line)
</pre>
<p>If you want a different color change the value in <strong>videobgcolor</strong> to something else (it&#8217;s like HTML colors).</p>
<hr />
<h4>VI: Full frame movies</h4>
<hr />
(You&#8217;ll find all this and more in my <a href="files/flashmovies-tex.zip">example</a>.)</p>
<p>The default beamer templates don&#8217;t support full-frame movies very well.  Here&#8217;s my functions; put them right before <strong>\begin{document}</strong> for a full frame movie.</p>
<pre class="brush: plain">
%%%%%%%%%%%%%%%% Useful commands %%%%%%%%%%%%%%%%

\newcommand\CopyrightText[1]{%
  \begin{textblock*}{\paperwidth}(0\paperwidth,.97\paperheight)%
    \hfill\textcolor{white}{\tiny#1}\hspace{3pt}
  \end{textblock*}
}

\newcommand{\citeFoot}[1]
{
    \rule{\linewidth}{0.5pt}
    {\scriptsize #1}
}

\newcommand{\fullFrameImage}[2]
{
    {
        \usebackgroundtemplate{\includegraphics[height=\paperheight]{#1}}
        \frame[plain]
        {
            \CopyrightText{ #2}
        }
    }
}

\newcommand{\fullFrameMovie}[2]
{
    {
        \setbeamertemplate{background canvas}[vertical shading][bottom=black,top=black]
        %\setbeamercolor{background canvas}{bg=black}

        \frame[plain]
        {
            \begin{textblock*}{\paperwidth}(0px,0px)%
            \flashmovie[width=\paperwidth,height=0.96\paperheight,engine=flv-player,auto=1,controlbar=0]{#1}
            \end{textblock*}
            \CopyrightText{#2}
        }

    }
}

\newcommand{\blackframe}
{
    {
        \setbeamertemplate{background canvas}[vertical shading][bottom=black,top=black]
        \frame[plane]{}
        \addtocounter{framenumber}{-1}
    }
}

%%%%%%%%%%%%%%%% End useful commands %%%%%%%%%%%%%%%%
</pre>
<p><strong>To use it:</strong></p>
<pre class="brush:plain">
\fullFrameMovie{movie.flv}{\textcircled{c} 1990 Someone Here}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.abarry.org/likelytobeforgotten/?feed=rss2&#038;p=61</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>flash encoding using ffmpeg</title>
		<link>http://www.abarry.org/likelytobeforgotten/?p=57</link>
		<comments>http://www.abarry.org/likelytobeforgotten/?p=57#comments</comments>
		<pubDate>Wed, 09 May 2012 22:23:57 +0000</pubDate>
		<dc:creator>abarry</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.abarry.org/likelytobeforgotten/?p=57</guid>
		<description><![CDATA[ffmpeg -i movie.avi -sameq movie.flv If you have issues with the sound and just want to remove it: ffmpeg -i movie.avi -an -sameq movie.flv]]></description>
			<content:encoded><![CDATA[<pre class="brush:bash">
ffmpeg -i movie.avi -sameq movie.flv
</pre>
<p>If you have issues with the sound and just want to remove it:</p>
<pre class="brush:bash">
ffmpeg -i movie.avi -an -sameq movie.flv
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.abarry.org/likelytobeforgotten/?feed=rss2&#038;p=57</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>S107G Helicopter Control via Arduino</title>
		<link>http://www.abarry.org/likelytobeforgotten/?p=55</link>
		<comments>http://www.abarry.org/likelytobeforgotten/?p=55#comments</comments>
		<pubDate>Wed, 21 Mar 2012 00:56:00 +0000</pubDate>
		<dc:creator>abarry</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.abarry.org/likelytobeforgotten/?p=55</guid>
		<description><![CDATA[I have worked with two types of S107G helicopters. One is a 2-channel (A and B) and the other is a 3-channel (A, B, and C) version. Their protocols differ significantly. The more common 2-channel (32-bit) version&#8217;s protocol is well documented elsewhere, so here I will only document the 3-channel (30-bit) version. (First posted at [...]]]></description>
			<content:encoded><![CDATA[<p>I have worked with two types of S107G helicopters. One is a 2-channel (A and B) and the other is a 3-channel (A, B, and C) version. Their protocols differ significantly. The more common 2-channel (32-bit) version&#8217;s protocol is well <a href="http://www.rcgroups.com/forums/showthread.php?t=1417249&amp;page=3">documented</a> <a href="http://www.avergottini.com/2011/05/arduino-helicopter-infrared-controller.html">elsewhere</a>, so here I will only document the 3-channel (30-bit) version.</p>
<p>(First posted at <a href="http://www.rcgroups.com/forums/showthread.php?t=1417249&amp;page=4">rcgroups</a>.)</p>
<p><a href="http://www.abarry.org/likelytobeforgotten/wp-content/uploads/2012/03/S107G.jpg"><img class="aligncenter size-full wp-image-58" title="S107G at FIAP Workshop" src="http://www.abarry.org/likelytobeforgotten/wp-content/uploads/2012/03/S107G.jpg" alt="S107G at FIAP Workshop" width="472" height="236" /></a></p>
<p>&nbsp;</p>
<p>The protocol for this is 30 bits long.</p>
<ul>
<li>To send a bit you flash the IR lights 16 times for a 0 and 32 times for a 1.</li>
<li>Each flash is off for 8-9 microseconds and on for 8-9 microseconds.</li>
<li>Between bits you wait for 300 microsecond</li>
<li>Between 30-bit packets you delay an amount depending on the channel you are using.</li>
<ul>
<li>Channel A: 136500 us</li>
<li>Channel B: 105200 us</li>
<li>Channel C: 168700 us</li>
</ul>
</ul>
<p>The order of the bits is as follows:</p>
<p>CC00 PPPP TTTT TTTT YYYY XXXX RRRR RR</p>
<p>C &#8211; channel<br />
P &#8211; pitch<br />
T &#8211; throttle<br />
Y &#8211; yaw<br />
X &#8211; checksum<br />
R &#8211; trim</p>
<p>There are a few other things to note:</p>
<p>1) It has a checksum. The 21-24th bits are a bitwise XOR of 4-bit words with the two zeros appended to the end of the bitstring. Thus you can compute the checksum for the first packet:</p>
<p>1000 0000 1000 1100 0000 1111 1111 11<br />
with:<br />
1000 ^ 0000 ^ 1000 ^ 1100 ^ 0000 ^ 1111 ^ 1100 = 1111</p>
<p>and for the second packet:</p>
<p>1000 0000 0011 1001 0000 0001 1111 11<br />
with<br />
1000 ^ 0000 ^ 0011 ^ 1001 ^ 0000 ^ 1111 ^ 1100 = 0001</p>
<p><span id="more-55"></span></p>
<p>2) The bits in the throttle, pitch, and yaw are reversed, so for throttle bit 16 is the most significant bit with bit 9 being the least significant for throttle.</p>
<p>3) Bit 20 is the direction bit for yaw and then bits 19-17 (aka reversed) are the speed bits. So for full yaw in one direction you do 1111 and for full yaw in the other direction you do 1110</p>
<p>4) Bit 8 is the direction bit for pitch with the speed bits being just like yaw.</p>
<p>5) The trim bits are probably reversed or something like that too but I just set them to 0 and didn&#8217;t worry.</p>
<p>Here&#8217;s my code for an Arduino. To use the code, open the Serial Monitor (Tools &gt; Serial Monitor) and use the following commands:</p>
<ul>
<li>0-9: throttle</li>
<li>w: forward</li>
<li>a: left</li>
<li>s: backwards</li>
<li>d: right</li>
<li>t: take off</li>
<li>u: increase throttle</li>
<li>j: decrease throttle</li>
<li>r: reset pitch and yaw</li>
</ul>
<p>&nbsp;</p>
<pre class="brush: c">

/* S107 3-channel with checksum helicopter control code
 * Copyright (C) 2012, Andrew Barry, Dan Barry
 *
 * Uses an Arduino to control a S107 helicopter
 *
 *
 * Instructions:
 *  Connect an IR LED array to pin 8 (using a FET to amplify the signal)
 *  and use the serial monitor to send commands to the system
 *
 */

#define LED 8

#define STATUS 13

//#define TAKEOFF_THROTTLE 240
//#define HOLDING_THROTTLE 130

byte yawCmd, pitchCmd, throttleCmd, trimCmd;

// Set this value for the default channel
// A = 0
// B = 1
// C = 2
byte channel = 0;

/*
 * Setup function that initializes the serial port and
 * sets some default values for the control variables.
 * Also sets up the pins we'll be using.
 */
void setup()
{
 Serial.begin(9600);
 pinMode(STATUS,OUTPUT);
 digitalWrite(STATUS,LOW);

 pinMode(LED,OUTPUT);
 digitalWrite(LED,LOW);

 yawCmd = 8;
 pitchCmd = 8;
 trimCmd = 0;
 throttleCmd = 0;

 Serial.println("throttle = 0, standing by for commands.");
}

/*
 * Function that does the actual work of converting commands into
 * IR LED pulses and changes the pins in the appropriate manner.
 */
byte sendPacket(byte yaw, byte pitch, byte throttle, byte trim)
{

 int packetData[100];
 int pulseNum;

 digitalWrite(STATUS,HIGH);

 float channelDelayValue = 136500;

 // channel A B or C
 // A is 10 with 136500us packet delay
 // B is 01 with 105200us packet delay
 // C is 11 with 168700us packet delay
 if (channel == 0)
 {
   packetData[0] = 1;
   packetData[1] = 0;
   channelDelayValue = 136500;

 } else if (channel == 1)
 {
   packetData[0] = 0;
   packetData[1] = 1;
   channelDelayValue = 105200;

 } else {
   packetData[0] = 1;
   packetData[1] = 1;
   channelDelayValue = 168700;

 }
 packetData[2] = 0;
 packetData[3] = 0;

 // pitch

 packetData[7] = (pitch &#038; 0b1000) >> 3; // direction bit

 if (pitch < 8)
 {
   pitch = 8 - pitch;
 }
 packetData[6] = (pitch &#038; 0b0100) >> 2; // others are speed bits, note that they are reversed
 packetData[5] = (pitch &#038; 0b0010) >> 1;
 packetData[4] = (pitch &#038; 0b0001);

 // throttle
 // bits are reversed in the throttle command
 packetData[15] =  (throttle &#038; 0b10000000) >> 7;
 packetData[14] =  (throttle &#038; 0b01000000) >> 6;
 packetData[13] = (throttle &#038; 0b00100000) >> 5;
 packetData[12] = (throttle &#038; 0b00010000) >> 4;

 packetData[11] = (throttle &#038; 0b00001000) >> 3;
 packetData[10] = (throttle &#038; 0b00000100) >> 2;
 packetData[9] = (throttle &#038; 0b00000010) >> 1;
 packetData[8] = (throttle &#038; 0b00000001);

 // yaw
 packetData[19] = (yaw &#038; 0b1000) >> 3; // direction bit
 if (yaw < 8)
 {
   yaw = 8 - yaw;
 }
 packetData[18] = (yaw &#038; 0b0100) >> 2;
 packetData[17] = (yaw &#038; 0b0010) >> 1;
 packetData[16] = (yaw &#038; 0b0001);

 // these 4 bits are the checksum, so make sure they
 // are 0s so they don't change the XOR later on
 packetData[20] = 0;
 packetData[21] = 0;
 packetData[22] = 0;
 packetData[23] = 0;

 // yaw trim / yaw adjust (the little dial on the controller)
 // 6 bits
 packetData[24] = 0;
 packetData[25] = 0;
 packetData[26] = 0;
 packetData[27] = 0;

 packetData[28] = 0;
 packetData[29] = 0;

 // these bits are never sent but we do the checksum
 // computation in 4-bit chunks, with the trailing two
 // bits set to zero, so we set them to zero here to make
 // the checksum a bit easier to compute
 packetData[30] = 0;
 packetData[31] = 0;

 int i;

 int checksum[10];
 checksum[0] = 0;
 checksum[1] = 0;
 checksum[2] = 0;
 checksum[3] = 0;

 // compute checksum -- bitwise XOR of 4-bit chuncks
 // with two zeros padding the *end* of the last two bits
 for (i=0; i<32; i+=4)
 {
   // XOR
   checksum[0] = packetData[i + 0] ^ checksum[0]; // the "^" operator is bitwise XOR (exclusive OR)
   checksum[1] = packetData[i + 1] ^ checksum[1];
   checksum[2] = packetData[i + 2] ^ checksum[2];
   checksum[3] = packetData[i + 3] ^ checksum[3];
 }

 // now set bits 21-24 (array values 20-23) to the checksum
 packetData[20] = checksum[0];
 packetData[21] = checksum[1];
 packetData[22] = checksum[2];
 packetData[23] = checksum[3];

 /*
  * Uncomment for realtime display of packet data
  */
  /*
 for (i=0; i<30; i++)
 {
   Serial.print(packetData[i]);
   if ((i+1)%4 == 0)
   {
     Serial.print(" ");
   }
 }
 Serial.println(" ");
 */

 // Send the packet by flashing the LEDs.  Also remember how long the packet takes to send
 // so we can properly compute how long to wait before sending the next packet.
 int bitsum = 0;

 for (i=0; i<30; i++)
 {
   // a "0" bit is 16 pulses and a "1" bit is 32 pulses
   if (packetData[i] == 1)
   {
     bitsum ++;
     pulseNum = 32;
   } else {
     pulseNum = 16;
   }

   // flash pulseNum times
   // a "0" bit is 16 pulses and a "1" bit is 32 pulses
   while(pulseNum--)
   {
     digitalWrite(LED,LOW);
     delayMicroseconds(9);
     digitalWrite(LED,HIGH);
     delayMicroseconds(8);
   }

   // there is a 300 microsecond delay between pulses of the LED
   delayMicroseconds(300);
 }

 // channel A B or C
 // A is 10 with 136500us packet delay
 // B is 01 with 105200us packet delay
 // C is 11 with 168700us packet delay
 //
 // that is the delay between sending 30 bit packets
 // note that this does not change if our packets are longer
 // or shorter, so we must take that into account

 return((channelDelayValue - bitsum * 272)/1000); // in ms.

}

void HoldCommand(int yawIn, int pitchIn, int throttleIn, int delayTime)
{
  Serial.print("Holding: Yaw:");
  Serial.print(yawIn);
  Serial.print(" Pitch: ");
  Serial.print(pitchIn);
  Serial.print(" Throttle: ");
  Serial.print(throttleIn);
  Serial.print(" for ");
  Serial.print(delayTime);
  Serial.println("ms");

  int i;
  int delayConst = 50;

  int delayAmount = delayTime/delayConst;
  int packetDelay;

  while (delayTime > 0)
  {
    if (Serial.available() == true)
    {
      Serial.println("HOLD ABORTED");
      break;
    }

    packetDelay = sendPacket(yawIn, pitchIn, throttleIn, trimCmd);
    delayTime = delayTime - packetDelay;

    delay(packetDelay);

    delay(delayAmount);
    delayTime = delayTime - delayAmount;
  }
  Serial.println("Done holding.");
}

void Land()
{
 static int i;
 Serial.println("Landing");
 for(i=throttleCmd;i>0;i--){
   HoldCommand(8,8,throttleCmd,50);
 }
 throttleCmd = 0;
}

/*
 * Function that manages recieving data from the serial port.
 * Mostly changes the global variables that are passed to the
 * control functions.
 */
void serialEvent()
{
 char cmd = Serial.read();
 Serial.println();
 Serial.print("command received is ");
 Serial.println(cmd);

 switch (cmd)
 {
   // Take off with 't'
   case 't':
     Serial.println("Taking Off");

     // Yaw: 1-15
     //    8 = no turn
     //    1 = max right turn
     //    15 = max left turn
     //
     // Pitch: 1-15
     //    8 = no pitch
     //    15 = max forward
     //    1 = max backwards
     //
     // Throttle: 0-255
     //    0 = off
     //    ~130 = steady flight
     //    ~240 = fast climb

     // First, go up with lots of throttle for 650ms
     // yaw: 8 --> no yaw
     // pitch: 8 --> no pitch
     // throttle: 240 --> fast climb
     // delay: 650ms --> enough time to climb, not too long so won't hit ceiling

     // HoldCommand: a function that sends the same data for a given amount of time
     // HoldCommand(yaw, pitch, throttle, time-to-hold-in-ms);
     HoldCommand(8, 8, 240, 650);

     // set the *global* throttle to steady flight throttle
     throttleCmd = 130;
     break;

   // land with 'x' or 'q'
   case 'x':
   case 'q':
     Land();
     break;

   // throttle commands
   case '0':
   case '1':
   case '2':
   case '3':
   case '4':
   case '5':
   case '6':
   case '7':
   case '8':
   case '9':
     throttleCmd = atoi(&#038;cmd) * 25;  //single character, so we can go from 0 to 255 by inputting 0 to 9 in the serial monitor
     break;

   // turn left
   case 'a':
     if (yawCmd < 15)
     {
       yawCmd ++;
     }
     Serial.print("Yaw is ");
     Serial.println(yawCmd);
     break;

   // turn right
   case 'd':
     if (yawCmd > 1)
     {
       yawCmd --;
     }
     Serial.print("Yaw is ");
     Serial.println(yawCmd);
     break;

   // move forwards
   case 'w':
     if (pitchCmd < 15){
       pitchCmd ++;  // moves forward
     }
     Serial.print("Pitch is ");
     Serial.println(pitchCmd);
     break;

   // move backwards
   case 's':
     if (pitchCmd > 1)
     {
       pitchCmd --;  // moves backward
     }
     Serial.print("Pitch is ");
     Serial.println(pitchCmd);
     break;

   // increase throttle
   case 'u':
     if (throttleCmd < 255 - 6)
     {
       throttleCmd += 6;
     }
     Serial.print("Throttle is ");
     Serial.println(throttleCmd);
     break;

   // decrease throttle
   case 'j':
     if (throttleCmd > 6)
     {
       throttleCmd -= 6;
     }
     Serial.print("Trottle is ");
     Serial.println(throttleCmd);
     break;

   // change channel
   case 'c':
     Serial.println("Changing channel");
     if (channel >= 2)
     {
       channel = 0;
     } else
     {
       channel ++;
     }
     Serial.print("Channel is: ");
     Serial.println(channel);
     break;

   // reset yaw and pitch
   case 'r':
     Serial.println("resetting yaw and pitch");
     yawCmd = 8;
     pitchCmd = 8;
     break;

   default:
     Serial.println("Unknown command");
 }
 Serial.print("Throttle is at ");
 Serial.println(throttleCmd);
}

/*
 * Loops continuously sending and delaying for the transmission
 */
void loop()

{
   // Note that serialEvent() gets called on each path of the loop
   // and runs if there is data at the serial port

   // we call delay here on the return value of sendPacket because that will
   // cause us to put the right amount of time between packets.  The delay is
   // not constant, but is instead based on how long the packet was
   // that we sent
   delay(sendPacket(yawCmd, pitchCmd, throttleCmd, trimCmd));
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.abarry.org/likelytobeforgotten/?feed=rss2&#038;p=55</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Run script on resume from suspend</title>
		<link>http://www.abarry.org/likelytobeforgotten/?p=49</link>
		<comments>http://www.abarry.org/likelytobeforgotten/?p=49#comments</comments>
		<pubDate>Fri, 02 Dec 2011 15:54:56 +0000</pubDate>
		<dc:creator>abarry</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.abarry.org/likelytobeforgotten/?p=49</guid>
		<description><![CDATA[Put your script into /etc/pm/sleep.d with a number at the beginning and mark it executable. Here&#8217;s an example that sets my Thinkpad mouse sensitivity and enables two-fingered scrolling on my touchpad. $ cat /etc/pm/sleep.d/99-trackpoint-and-twofinger #!/bin/bash case "$1" in thaw&#124;resume) echo -n 220 &#62; /sys/devices/platform/i8042/serio1/serio2/sensitivity 2&#62; /dev/null echo -n 95 &#62; /sys/devices/platform/i8042/serio1/serio2/speed 2&#62; /dev/null xinput set-int-prop [...]]]></description>
			<content:encoded><![CDATA[<p>Put your script into</p>
<pre>/etc/pm/sleep.d</pre>
<p>with a number at the beginning and mark it executable. Here&#8217;s an example that sets my Thinkpad mouse sensitivity and enables two-fingered scrolling on my touchpad.</p>
<pre>$ cat /etc/pm/sleep.d/99-trackpoint-and-twofinger</pre>
<pre class="brush: bash">#!/bin/bash
case "$1" in
    thaw|resume)
	echo -n 220 &gt; /sys/devices/platform/i8042/serio1/serio2/sensitivity 2&gt; /dev/null
	echo -n 95 &gt; /sys/devices/platform/i8042/serio1/serio2/speed 2&gt; /dev/null
	xinput set-int-prop 'SynPS/2 Synaptics TouchPad' "Synaptics Two-Finger Pressure" 32 4
xinput set-int-prop 'SynPS/2 Synaptics TouchPad' "Synaptics Two-Finger Width" 32 7
xinput set-int-prop 'SynPS/2 Synaptics TouchPad' "Synaptics Two-Finger Scrolling" 8 1 1
xinput set-int-prop 'SynPS/2 Synaptics TouchPad' "Synaptics Jumpy Cursor Threshold" 32 250
        ;;
    *)
        ;;
esac
exit $?</pre>
<p>Note that if you want to have the script run at boot as well you probably want to add your code to</p>
<pre>/etc/rc.local</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.abarry.org/likelytobeforgotten/?feed=rss2&#038;p=49</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VirtualDub settings for .MTS video</title>
		<link>http://www.abarry.org/likelytobeforgotten/?p=48</link>
		<comments>http://www.abarry.org/likelytobeforgotten/?p=48#comments</comments>
		<pubDate>Fri, 11 Nov 2011 23:12:44 +0000</pubDate>
		<dc:creator>abarry</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.abarry.org/likelytobeforgotten/?p=48</guid>
		<description><![CDATA[Video: MTS off a Canon Vixia HG21. Setup: Linux, working in wine. Conversion to avi for VirtualDub/AviSynth: ffmpeg -i 00394.MTS -vcodec libxvid -b 100000k -deinterlace -acodec libmp3lame output.avi Set up VirtualDub: Options &#62; Preferences &#62; AVI &#62; Check Directly decode uncompressed YCbCr (YUV) sources Select Video &#62; Compression&#8230; Select ffdshow Video Codec Select Configure and [...]]]></description>
			<content:encoded><![CDATA[<p>Video: MTS off a Canon Vixia HG21.<br />
Setup: Linux, working in wine.</p>
<p>Conversion to avi for VirtualDub/AviSynth:</p>
<pre class="brush:bash">ffmpeg -i 00394.MTS -vcodec libxvid -b 100000k -deinterlace -acodec libmp3lame output.avi</pre>
<p>Set up VirtualDub:</p>
<ul>
<li>Options &gt; Preferences &gt; AVI &gt; Check <strong>Directly decode uncompressed YCbCr (YUV) sources</strong></li>
<li>Select <strong>Video &gt; Compression&#8230;</strong></li>
<ul>
<li>Select <strong>ffdshow Video Codec</strong></li>
<li>Select <strong>Configure</strong> and then set the <strong>bitrate</strong> to <strong>10000</strong></li>
</ul>
<li>Select <strong>Video &gt; Fast recompress</strong></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.abarry.org/likelytobeforgotten/?feed=rss2&#038;p=48</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speed up MATLAB figures with OpenGL</title>
		<link>http://www.abarry.org/likelytobeforgotten/?p=47</link>
		<comments>http://www.abarry.org/likelytobeforgotten/?p=47#comments</comments>
		<pubDate>Tue, 08 Nov 2011 17:56:43 +0000</pubDate>
		<dc:creator>abarry</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.abarry.org/likelytobeforgotten/?p=47</guid>
		<description><![CDATA[You can substantially increase your MATLAB figure performance by using OpenGL rendering. Put this in your startup.m file: set(0, 'DefaultFigureRenderer', 'OpenGL'); You can check if MATLAB has detected your hardware by using: >> opengl info Other relevant figure properties are: >> set(gcf,'Renderer','OpenGL') >> set(gcf,'RendererMode','manual') Warning: this breaks saving EPS files as vectorized figures.]]></description>
			<content:encoded><![CDATA[<p>You can substantially increase your MATLAB figure performance by using OpenGL rendering.  Put this in your startup.m file:</p>
<pre class="brush:c">
set(0, 'DefaultFigureRenderer', 'OpenGL');
</pre>
<p>You can check if MATLAB has detected your hardware by using:</p>
<pre class="brush:c">
>> opengl info
</pre>
<p>Other relevant figure properties are:</p>
<pre class="brush:c">
>> set(gcf,'Renderer','OpenGL')
>> set(gcf,'RendererMode','manual')
</pre>
<p><strong>Warning:</strong> this breaks saving EPS files as vectorized figures.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abarry.org/likelytobeforgotten/?feed=rss2&#038;p=47</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gumstix wifi (wlan1: link not ready)</title>
		<link>http://www.abarry.org/likelytobeforgotten/?p=42</link>
		<comments>http://www.abarry.org/likelytobeforgotten/?p=42#comments</comments>
		<pubDate>Sun, 16 Oct 2011 02:46:59 +0000</pubDate>
		<dc:creator>abarry</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.abarry.org/likelytobeforgotten/?p=42</guid>
		<description><![CDATA[I just spent a long time trying to diagnose an issue with a Gumstix Overo Fire and brining up WiFi (802.11b/g) on boot.  I did all the standard things (when using a desktop image, you must uninstall NetworkManager and then set up your configuration in /etc/network/interfaces. I could get a connection sometimes, but it was [...]]]></description>
			<content:encoded><![CDATA[<p>I just spent a long time trying to diagnose an issue with a Gumstix Overo Fire and brining up WiFi (802.11b/g) on boot.  I did all the standard things (when using a desktop image, you must uninstall NetworkManager and then set up your configuration in /etc/network/interfaces.  I could get a connection sometimes, but it was very unclear why it would or would not connect.  So unclear that I couldn&#8217;t write a script that would bring the WiFi up on boot.</p>
<p>I kept getting this issue:</p>
<pre class="brush: bash">
ADDRCONF(NETDEV_UP): wlan1: link is not ready
</pre>
<p>occasionally followed by the better:</p>
<pre class="brush: bash">
ADDRCONF(NETDEV_CHANGE): wlan1: link becomes ready
</pre>
<p>Also, something odd was going on that I don&#8217;t understand because when the interface would configure on boot, it would rename to wlan1:</p>
<pre class="brush: bash">
[... boot messages ...]
libertas_sdio: Libertas SDIO driver
libertas_sdio: Copyright Pierre Ossman
Remounting root file system...
libertas: 00:19:88:21:59:1c, fw 9.70.7p0, cap 0x00000303
libertas_sdio mmc1:0001:1: wlan0: Features changed: 0x00004800 -> 0x00004000
libertas: wlan0: Marvell WLAN 802.11 adapter
udev: renamed network interface wlan0 to wlan1
Caching udev devnodes
[...]
</pre>
<p>Finally, I found a solution: use an image from 2010.  I&#8217;m using the omap3-console-image-overo-201009091145 build found <a href="http://www.sakoman.com/feeds/omap3/glibc/images/overo/201009091145/">here</a> and mirrored locally <a href="../gumstix/201009091145">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abarry.org/likelytobeforgotten/?feed=rss2&#038;p=42</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Colors in `ls`</title>
		<link>http://www.abarry.org/likelytobeforgotten/?p=44</link>
		<comments>http://www.abarry.org/likelytobeforgotten/?p=44#comments</comments>
		<pubDate>Sun, 16 Oct 2011 02:35:59 +0000</pubDate>
		<dc:creator>abarry</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.abarry.org/likelytobeforgotten/?p=44</guid>
		<description><![CDATA[How to make (a gumstix say) show colors for ls (assuming your login shell is bash). Edit ~/.bashrc and ~/.bash_profile to match these files: Make sure your shell is bash (if it&#8217;s not, you can change it in /etc/passwd): root@overo:~# echo $SHELL /bin/bash In ~/.bashrc: root@overo:~# cat .bashrc export LS_OPTIONS='--color=auto' eval `dircolors` alias ls='ls $LS_OPTIONS' [...]]]></description>
			<content:encoded><![CDATA[<p>How to make (a gumstix say) show colors for ls (assuming your login shell is bash).  Edit ~/.bashrc and ~/.bash_profile to match these files:</p>
<p>Make sure your shell is bash (if it&#8217;s not, you can change it in /etc/passwd):</p>
<pre class="brush:bash">
root@overo:~# echo $SHELL
/bin/bash
</pre>
<p>In ~/.bashrc:</p>
<pre class="brush:bash">
root@overo:~# cat .bashrc
export LS_OPTIONS='--color=auto'
eval `dircolors`
alias ls='ls $LS_OPTIONS'
</pre>
<p>In ~/.bash_profile:</p>
<pre class="brush:bash">
root@overo:~# cat .bash_profile
source ~/.bashrc
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.abarry.org/likelytobeforgotten/?feed=rss2&#038;p=44</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recursively get (or set) a property in svn</title>
		<link>http://www.abarry.org/likelytobeforgotten/?p=25</link>
		<comments>http://www.abarry.org/likelytobeforgotten/?p=25#comments</comments>
		<pubDate>Fri, 12 Aug 2011 12:55:08 +0000</pubDate>
		<dc:creator>abarry</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.abarry.org/likelytobeforgotten/?p=25</guid>
		<description><![CDATA[Edit: There&#8217;s an easier way to delete properties recursively: svn propdel -R rlg:email robotlib-mydev Use find to traverse recursively through the directory structure: find . -type d \! -path *.svn* -exec echo {} \; -exec svn propget rlg:email {}@ \; To print out the current directory: -exec echo {} \; To find only directories: -type [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Edit:</strong> There&#8217;s an easier way to delete properties recursively:</p>
<pre class="brush:bash">
svn propdel -R rlg:email robotlib-mydev
</pre>
<p>Use <strong>find</strong> to traverse recursively through the directory structure:</p>
<pre class="brush:bash">
find . -type d \! -path *.svn* -exec echo {} \; -exec svn propget rlg:email {}@ \;
</pre>
<p>To print out the current directory:</p>
<pre class="brush: bash">
-exec echo {} \;
</pre>
<p>To find only directories:</p>
<pre class="brush: bash">
-type d
</pre>
<p>To ignore svn folders:</p>
<pre class="brush: bash">
\! -path *.svn*
</pre>
<p>To execute the propget command:</p>
<pre class="brush: bash">
-exec svn propget rlg:email {}@ \;
</pre>
<p>The {} is the place find puts the path and the @ at the end causes SVN to parse correctly for paths that have &#8220;@&#8221; in them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abarry.org/likelytobeforgotten/?feed=rss2&#038;p=25</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Firefox 5 extension compatibility check</title>
		<link>http://www.abarry.org/likelytobeforgotten/?p=23</link>
		<comments>http://www.abarry.org/likelytobeforgotten/?p=23#comments</comments>
		<pubDate>Mon, 27 Jun 2011 16:45:15 +0000</pubDate>
		<dc:creator>abarry</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.abarry.org/likelytobeforgotten/?p=23</guid>
		<description><![CDATA[The old preference for disabling compatibility checks (extensions.checkCompatibility) is now gone. The new one marks the version you chose to do this at: To re-enable your broken (but likely still working) add-ons in Firefox 5.0, add the extensions.checkCompatibility.5.0 preference in about:config: 1. Type about:config into the firefox URL bar. 2. Click I&#8217;ll be careful, I [...]]]></description>
			<content:encoded><![CDATA[<p>The old preference for disabling compatibility checks (<strong>extensions.checkCompatibility</strong>) is now gone.  The new one marks the version you chose to do this at:</p>
<p>To re-enable your broken (but likely still working) add-ons in Firefox 5.0, add the <strong>extensions.checkCompatibility.5.0</strong> preference in about:config:</p>
<p>1. Type <strong>about:config</strong> into the firefox URL bar.</p>
<p><img src="http://www.abarry.org/likelytobeforgotten/wp-content/uploads/2011/06/aboutconfig.png" alt="" title="aboutconfig" width="150" height="53" class="aligncenter size-full wp-image-26" /></p>
<p><span id="more-23"></span></p>
<p>2. Click <strong>I&#8217;ll be careful, I promise</strong></p>
<p><img src="http://www.abarry.org/likelytobeforgotten/wp-content/uploads/2011/06/warranty2.png" alt="" title="warranty" width="458" height="354" class="aligncenter size-full wp-image-34" /></p>
<p>3. Right-click and select <strong>New > Boolean</strong></p>
<p><img src="http://www.abarry.org/likelytobeforgotten/wp-content/uploads/2011/06/newboolean.png" alt="" title="newboolean" width="328" height="269" class="aligncenter size-full wp-image-30" /></p>
<p>4. Enter <strong>extensions.checkCompatibility.5.0</strong></p>
<p><img src="http://www.abarry.org/likelytobeforgotten/wp-content/uploads/2011/06/enterName.png" alt="" title="enterName" width="390" height="174" class="aligncenter size-full wp-image-29" /></p>
<p>5. Select <strong>false</strong></p>
<p><img src="http://www.abarry.org/likelytobeforgotten/wp-content/uploads/2011/06/enterFalse.png" alt="" title="enterFalse" width="351" height="203" class="aligncenter size-full wp-image-28" /></p>
<p>6. Restart Firefox</p>
<p><img src="http://www.abarry.org/likelytobeforgotten/wp-content/uploads/2011/06/restartFirefox1.png" alt="" title="restartFirefox" width="230" height="352" class="aligncenter size-full wp-image-32" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.abarry.org/likelytobeforgotten/?feed=rss2&#038;p=23</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

