Getting Drones in the Classroom

Getting Drones in the Classroom

On Friday April 1st, 2016, the Connecticut Department of Education hosted their first annual CTE-STEM Spring Conference. It was an opportunity for education and industry professionals to share experiences and the latest tools teaching career skills and STEM principles to high school students. I was elated to be invited to participate and speak for one of the sessions on programming and FIRST robotics! But before we get there, I’d like to cover a few interesting tidbits of information and resources for students and educators alike from some of the conferences topics. In this second post of a little mini-series: getting drones in the classroom.

This talk was also lead by William McDonough of Masuk High School, the same speaker from the keynote. In the session, William described how he has been experimenting with drones as a teaching tool for his class. He acquired a DJI Phantom 3 Professional similar to the one in the feature image with the help of a Perkins grant. The class has used the drone in a few projects, mostly acquiring areal photography for analysis in civil projects. Check out their demo reel on YouTube from the high school website link above.

Getting this all started had its fair share of challenges. First William needed to comply with new regulations from the government by registering the drone with the FAA. I don’t have a drone to register, but a cursory look at the form seems like it’s very simple. With five dollars to the FAA and a registration number engraved or permanently affixed to the drone, you’re flying legal for the next three years.

The FAA has also released proposed rules for pilots that William required students in the class to have read and demonstrated comprehension. Here are some consolidated excerpts from the Overview of Small UAS Notice of Proposed Rulemaking:

  • Must remain within visual line of sight of the operator
  • May not operate over any persons not directly involved in the operation
  • Daylight-only operations
  • Maximum airspeed of 100 mph (87 knots)
  • Maximum altitude of 500 feet above ground level
  • Minimum weather visibility of 3 miles from control station
  • No careless or reckless operations

What if anything bad were to happen to something or someone while operating the drone? Even though the Phantom 3 Pro can handle 40mph crosswinds, other powers out of a pilots control could affect the drones flight in unexpected and unfortunate ways. Insurance is a necessity.

And acquiring that insurance was a bit trickier. The school system’s insurance wasn’t capable of handling anything caused as a result of drone activities during the class. Fortunately William found that registered pilots with the Association of Model Aeronautics (AMA) are provided with coverage for general liability, accident, medical, fire, vandalism, and theft! While a full adult membership costs up to $75 per year, the AMA offers free youth memberships until the age of nineteen. So, in addition to understanding the proposed FAA rules, each student that was qualified to fly the drone must have confirmed they were registered with the AMA.

The AMA has a number of additional resources available to pilots as well. The organization releases several safety codes depending on the type of aircraft, location an aircraft is flown, and flight conditions. So once again, in addition to understanding the proposed FAA rules, and registering with the AMA, each student must have also read and demonstrated understanding of these safety codes.

While William and his class had to go through these steps to operate a drone for educational purposes, these steps are also a great idea for any new or current drone pilot. Hopefully these help more students and amateur pilots alike get into what is becoming a game changing technology very quickly! 🙂

Feature Imaged by Jacek Halicki (Own work) [CC BY-SA 4.0], via Wikimedia Commons

Howto: Recover Web Data from a Browser

Howto: Recover Web Data from a Browser

Yesterday morning I accidentally deleted my last post. Done. Finito. Gone. Drafted, typed, published, and deleted. But! After 15 minutes of searching, installing a program, and copy / pasting, you can’t tell at all. 🙂

So here’s the story. When I started writing that post, I began from the WordPress app on my phone, an old HTC One M7, jotting down the big ideas. Then, I saved the changes to the WordPress servers, and finished up from my laptop in the website’s editor. I published the post, did a little publicizing on Twitter, and thought nothing more of it.

But my phone still had the old draft of the post. I figured if I update the version on my phone, there’s no chance of accidentally removing the post, or reverting it to an old version. So I tapped the Update button on the draft page. Well, reverting to the old version is exactly what happened. The old contents from the phone draft overwrote the contents on the website. No backups, no save files, just lost content, and a urge to pull out my hair.

This isn’t the first time that I’ve accidentally lost something in an online editor. And I’m sure it won’t be the last. Fortunately, I’ve found success relying on unintentional backups left behind by the applications in the past. Cache files are abundant if you know where to look, and if you don’t delete them. Chances are if you move fast and find the content before the browser automatically removes the cache, all will be right in the world again.

Lately, I’ve been using Chrome, so a little online search led me to this SuperUser post. Without downloading anything special, going to chrome://cache will show some raw header and content information, but nothing was formatted well enough to read the posts content. NirSoft’s ChromeCacheView is a welcome alternative. This lets you easily view the content as well as the headers.

To view a page in the chrome cache using ChromeCacheView, first set the double click action to open the selected file.

ChromeCacheView-options

Then, search for the page you want to restore by hitting Ctrl+F. In my case, I had viewed the page after I posted it, so I searched for the name of the blog.

ChromeCacheView-find

After double clicking, the page opened in Chrome. I copied the contents back into the web version of the wordpress editor, and re-published.

Crisis averted.

Since I did this, the version on my phone is now in sync with the server version… and I’m not sure why…

Appreciating Communication Skills

This past Friday, the Connecticut Department of Education hosted their first annual CTE-STEM Spring Conference. It was an opportunity for education and industry professionals to share experiences and the latest tools teaching career skills and STEM principles to high school students. I was elated to be invited to participate and speak for one of the sessions on programming and FIRST robotics! But before we get there, I’d like to cover a few interesting tidbits of information and resources for students and educators alike from some of the conferences topics in this first post of a little mini-series. First up, appreciating communication skills and how it relates to the success of students.

The keynote, led by William McDonough of Masuk High School, looked at teaching CTE and STEM, its evolution, and what’s coming in the future. During the talk, William mentioned that communication skills are an extremely important skill for young engineers to learn early. I couldn’t agree more! Basic communication skills are necessary for mental health, and expanding those skills to allow you to cover large, complex, and technical topics are pivotal for successful years in college or in a career.

As my mentor at work once told me, “key to success is to help other people be successful,” and communication is a skill you need to do so. If you are able to communicate your ideas clearly and concisely, you will be able to teach and lead effectively. Your peers will be able to appreciate the time, effort, and thought your creations required. They will be able to understand the intent behind why you chose to implement one solution over another, and in turn will be able to support you when you need help. With the right communication skills, you can be able to be an active listener as well. While anyone can smile and nod, if you are able to acknowledge someone else’s ideas in the moment of the conversation, even in the most tense of moments, you will build trust, respect, and comprehension.

During the keynote, William introduced an interesting exercise to help students appreciate effective and clear technical communication. One of William’s colleagues led an activity asking their students to translate an IKEA furniture assembly manual into plain English. Each picture needed to accurately represent in text such that someone who was unfamiliar with the design could be able to assemble the final product without questions. This drew some “ahs” and quick note scribbles from the attendees of the talk. It sounds like a fun exercise to me too. I’d like to in corporate it into a workshop or build session with my robotics team, Athena’s Warriors, and report back on its reception with the students. Would you try something like this? Have you already with some success? Or failure?

My Experience Setting-up FRCSim

My Experience Setting-up FRCSim

Getting into It

FRCSim has a lot of promise. Extend your SolidWorks CAD with some joints and physics, and roll around a virtual field?! Yes, please! Just imagine all the awesome experimentation you could do with it to improve the quality of the control system. Test your autonomous mode! Tune your PID control gains! Be sure your drive team has the controls they need! And all prior to getting to an FRC competition. I’m also interested in using it as an education tool: it has the potential to open up programming to non-programmers in FIRST and to educators outside the program as well! However as with many new technologies it is a delicate system. A lot needs to be configured correctly in order to get the basic functionality working well.

So I thought it might be useful to share my experience getting FRCSim up and running. The wpilib folks have already put together an excellent user’s guide which leads you through the process of installing and configuring the toolchain, so I won’t be copying that effort here. Instead, these are my experiences so far, and recommendations on how to best install, tweak, test, and navigate the system.

Before jumping into the user’s guide for yourself, you may find it useful to print off a copy which is also available as a PDF.

Installing Ubuntu

The installation begins with Ubuntu, a popular distribution of the linux operating system. There appears to be some support for OS X, but I don’t have a Mac to test this. Ubuntu is well detailed in the user’s guide, and I’ve had a great time with it in the past. I used it as my daily driver operating system in college, back when it really starting to gain popularity.

The top of the Installing Ubuntu page suggests using the older 14.04 LTS (Long Term Service) since the wpilib folks have an automatic installation script for the whole FRCSim toolchain. When I first attempted the procedure, I wasn’t interested in running old software. Later on the same page, the Running in a Virtual Machine section also mentions FRCSim should work with the more recent 15.10 Ubuntu version. So I decided to move forward with that, and started the download of the 64bit .iso.

While that was downloading, I had some installation options to consider. Some folks may want to dual-boot as it would be ideal from a performance perspective. Installing the operating system on the hard drive would avoid throughput bottlenecks typically seen in live booting from a DVD or USB drive. This would also avoid weathering a USB drive faster than usual. But sharing this with my team (FRC Team 3182 – Athena’s Warriors) and anyone else who’s interested was and is paramount! So I scrounged up a 16GB USB drive, plugged it into an open port, and prepared the installation.

By the time the download completed, I had VirtualBox up and running. I created a new virtual machine in it, making sure that the USB drive was available to it. I started the virtual machine, selected the .iso I downloaded as the boot medium, and followed the standard installation procedure using the USB drive as the “hard drive”. And after that completed, I had a shiny new live USB drive with a stock Ubuntu 15.10 ready to go! (The user’s guide has a little more detail on these steps.)

Installing the FRCSim Toolchain

With my fresh installation of Ubuntu ready to run, I booted into it and began installing the FRCSim toolchain. As I mentioned earlier, if I had chosen to use Ubuntu 14.04, the wpilib folks provide a script and one-step procedure to install almost everything for you. Very nice! Unfortunately, that’s not compatible with newer Ubuntu versions. So instead I had to follow the more complicated, but not impossible manual procedure. Saving you the boring hour or so, the installation went along without any issues.

Or so I thought. When I first tried to run FRCSim, I got a rather cryptic error:

[Err] [Plugin.hh:165] Failed to load plugin /home/ubuntu/wpilib/simulation/plugins/liblimit_switch.so: libboost_system.so.1.54.0: cannot open shared object file: No such file or directory
 gzclient: /build/ogre-1.9-VJX7tp/ogre-1.9-1.9.0+dfsg1/OgreMain/src/OgreRenderSystem.cpp:546: virtual void Ogre::RenderSystem::setDepthBufferFor(Ogre::RenderTarget*): Assertion `bAttached && "A new DepthBuffer for a RenderTarget was created, but after creation" "it says it's incompatible with that RT"' failed.

From that first line, it appears I’m missing one of the basic Boost libraries, but Boost was installed automatically as part of a step in the manual procedure. A little bit of googling turns up the issue in the wpilib issue tracker and on a chief delphi post. Boost version 1.54.0 is hard coded into the Gazebo plugins wpilib provides, but Ubuntu 15.10 only has the newer Boost-1.58.0 in its repository. Rather than force the Gazebo plugins to rely on a library they weren’t designed for (via for example symbolic links), I tried manually installing Boots-1.54.0.

To get the appropriate version of Boost, I needed to build it from source: the typical linux bootstrap, compile, and install. The Boost developers provide a very easy way of going about this using their own bjam utility. And following the advice in this stack exchange post, using checkinstall to make it a pseudo package sounded particularly appealing. This would treat the source build as any other package installed on the system. I’ve never worked with it before, so I gave it a shot and… checkinstall failed.

And this is where I began to re-evaluate what was important. 🙂 Why am I trying to install a pseudo package of an older Boost library on a newer Ubuntu release to appease the hard coded value in the Gazebo plugin? (Try saying that on one breath!) Why not just use Ubuntu 14.10 and the wpilib install script? What is truly important in life???

So, after I downloaded and installed the recommended Ubuntu 14.04, and ran the wpilib installer script, I had even more time to figure that out, worry free. 🙂

Hello World

The Simulating GearsBot with FRCSim page of the user’s guide walks you through creating a project in Eclipse, and simulating a sample configuration using an existing model called “GearsBot”. This is a good demonstration of what could be done with the right tools. The model is moderately rendered, joints and physics seems accurate, and the code is complete.

It runs great on my custom built high performance desktop machine, but my old Toshiba Portege R705-P25 laptop doesn’t fare so well. Built in 2010 with no dedicated graphics card, the physics and graphics simulations are a huge tax on the system. Frame rates drop to flip-book levels making FRCSim nearly unusable.

Fortunately, another sample model called “EKIPS” is low power friendly. While GearsBot doesn’t have every plate, mount, motor, and component rendered, (like the alternative “PacGoat” seems to have), EKIPS is just a few blocks and wheels. This minimizes the strain on my old laptop raising the frame rate above a usable 30 frames per second. Using this robot lowers the computational barrier for entry, allowing more potential programmers to have access to FRCSim.

There is no code provided for EKIPS, but expanding on some of the tutorials in Eclipse should be enough to at least get the robot rolling. For example, here’s some code that will drive EKIPS with a single joystick in arcade mode.

/**
 * This is a demo program showing the use of the RobotDrive class with the EKIPS
 * robot in FRCSim.
 */
public class Robot extends SampleRobot {
  // Simple robot handling instance variable
  RobotDrive myRobot;

  // A joystick instance variable
  Joystick joystick;

  // Robot class constructor. Inits channels for drive motors and joystick
  // USB id numbers
  public Robot() {
    myRobot = new RobotDrive(4, 3, 2, 1);
    joystick = new Joystick(0);
  }

  // This function is called when entering teleoperated mode
  public void operatorControl() {
    // Be sure the drive motor safety system is disabled. (This system will
    // prevent the motors from driving if not commanded at a regular interval.)
    myRobot.setSafetyEnabled(false);

    // While we haven't left teleoperated mode and the robot is enabled
    while (isOperatorControl() && isEnabled()) {
      // Command the robot to drive based on the joystick in arcade
      // configuration.
      myRobot.arcadeDrive(-1 * joystick.getX(), -1 * joystick.getRawAxis(0));

      // Wait 5ms to allow other processes time to run on the roboRio and not
      // bog down the system.
      Timer.delay(0.005);
    }
  }
}

Joystick Configuration

Time to drive that ‘bot! After running FRCSim, the simulated driver station (sim_ds), and the robot code in Eclipse, none of the joysticks I plugged into my computer showed up in sim_ds! Turns out that stock Ubuntu doesn’t have game controller support. To get physical joysticks to work in FRCSim I also had to download a couple additional packages:

  • joystick – A set of testing an calibration tools for joysticks
  • jstest-gtk – A joystick testing and configuration graphical user interface.
sudo apt-get install joystick jstest-gtk

No special configuration here. After these were installed, the joysticks popped up in sim_ds and worked fine. And running the jstest-gtk tool help me identify what button was what in the software.

Final Remarks

And with that, I’m off and running simulating to my heart’s content! Here are a few other random tips and things to consider as you begin simulating robots for yourself.

I find that running FRCSim, sim_ds, and Eclipse’s simulation target is a delicate game of spinning plates. If you’re having issues but everything seems to be coded and configured correctly, try restarting the FRCSim, or sim_ds, or both and rerunning the code in eclipse. I find it use full to have a separate terminal window open for each application, each in it’s own virtual desktop. This allows me to see more output from each application and get back to developing faster when an issue comes up.

Joystick axes, buttons, and id numbers may change between operating systems. Be sure to check your ids in the code when moving between Windows, Linux, and OS X before debugging other related issues.

Running a live system from a USB drive can weather it more quickly than using it solely for file transfers. While you should be fine while you experiment with FRCSim, one common way to prevent excessive wear is by disabling access time updates to files within the operating system. This is handled by the file system table file: /etc/fstab. Add the noatime option to your fstab by appending it to the options list preceded with a comma. For example, my fstab looks like this.

# <file system> <mount point> <type> <options> <dump> <pass>
UUID=ee3de0ce-7e50-46f5-b0b9-ca1548b961ef / ext4 errors=remount-ro,noatime 0 1

Finally, minimizing the workload on the GPU of your system by non-essential applications may lead to better overall performance. Unfortunately, Ubuntu’s default Unity desktop uses the same hardware acceleration your simulation is using! For resource-strapped systems such as my laptop, this is an issue. To get around it, you can install the classic version of Gnome’s interface, known as gnome-flashback to the package manager. And personally, I like this interface a lot more than Unity. 🙂

sudo apt-get install gnome-flashback