Go to Post "We just fundraised $5000 for registration, and you spent it all on balloons?" - [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-02-2016, 11:09
dc74089's Avatar
dc74089 dc74089 is offline
Control Systems Lead
AKA: Dominic
FRC #1902 (Exploding Bacon)
Team Role: Programmer
 
Join Date: Dec 2013
Rookie Year: 2011
Location: Orlando
Posts: 25
dc74089 will become famous soon enough
Shutting Down a Robot-Mounted Pi

Hi all,

We're planning on using a Raspberry Pi on the robot this year, but we're having trouble wrapping our heads around how to properly shut it down when the robot shuts off. Linux systems HATE having their power just pulled, so we've been trying to find a way to prevent corruption every time we shut off the robot.

We've been trying to get the Pi to mount its filesystem as read-only, but when we do that, networking disappears (and we need Ethernet working). Neither Stack Exchange nor the rest of the internet seems to have any remedy that has worked for us.

Teams that have used a robot-mounted Pi, how have you made sure that the Pi doesn't get corrupted when the robot power is turned off?
__________________
-Dominic
Think big. Think smart. Think different.

FLL - Nerdvana (2011-12)
FTC - Nerdvana/Clockwork Mania 6379 (2012-13), Team HazMat 9277 (2014-?)
FRC - Clockwork Mania 4013 (2014), Exploding Bacon 1902 (2015-?)
  #2   Spotlight this post!  
Unread 12-02-2016, 11:17
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Shutting Down a Robot-Mounted Pi

Quote:
Originally Posted by dc74089 View Post
Hi all,

We're planning on using a Raspberry Pi on the robot this year, but we're having trouble wrapping our heads around how to properly shut it down when the robot shuts off. Linux systems HATE having their power just pulled, so we've been trying to find a way to prevent corruption every time we shut off the robot.

We've been trying to get the Pi to mount its filesystem as read-only, but when we do that, networking disappears (and we need Ethernet working). Neither Stack Exchange nor the rest of the internet seems to have any remedy that has worked for us.

Teams that have used a robot-mounted Pi, how have you made sure that the Pi doesn't get corrupted when the robot power is turned off?
Honestly I have never had a problem. The RPi shouldn't be doing any critical system tasks when processing vision stuff. I've shut it down most of the time by pulling the power.

Sure, there are risks involved... but think about it this way. What does the RoboRIO run? What about your home router? (Answer is Linux).

Most of the time we just pull the power on those and expect them to come back up. I expect no different from the RPi.
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364
  #3   Spotlight this post!  
Unread 12-02-2016, 11:18
techhelpbb's Avatar
techhelpbb techhelpbb is offline
Registered User
FRC #0011 (MORT - Team 11)
Team Role: Mentor
 
Join Date: Nov 2010
Rookie Year: 1997
Location: New Jersey
Posts: 1,620
techhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond repute
Re: Shutting Down a Robot-Mounted Pi

Here's one way
  #4   Spotlight this post!  
Unread 12-02-2016, 11:24
dc74089's Avatar
dc74089 dc74089 is offline
Control Systems Lead
AKA: Dominic
FRC #1902 (Exploding Bacon)
Team Role: Programmer
 
Join Date: Dec 2013
Rookie Year: 2011
Location: Orlando
Posts: 25
dc74089 will become famous soon enough
Re: Shutting Down a Robot-Mounted Pi

I know for certain the RoboRIO OS is hardened to be able to accept a sudden shutdown, and I'd assume any decent home router was designed with the thought that they shouldn't expect a graceful shutdown.

Raspbian has corrupted SDs on me in the past, but if teams haven't had issues with FRC-related tasks, I guess it's worth a try. Thanks!
__________________
-Dominic
Think big. Think smart. Think different.

FLL - Nerdvana (2011-12)
FTC - Nerdvana/Clockwork Mania 6379 (2012-13), Team HazMat 9277 (2014-?)
FRC - Clockwork Mania 4013 (2014), Exploding Bacon 1902 (2015-?)
  #5   Spotlight this post!  
Unread 12-02-2016, 11:20
JohnFogarty's Avatar
JohnFogarty JohnFogarty is offline
FTC, I have returned.
AKA: @doctorfogarty @GarnetSq
FTC #11444 (Garnet Squadron) & FRC#1102 (M'Aiken Magic)
Team Role: Mentor
 
Join Date: Aug 2009
Rookie Year: 2006
Location: SC
Posts: 1,555
JohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond repute
Re: Shutting Down a Robot-Mounted Pi

Our team is using a Pi on our robot this year and found that issues with corruption don't exist, as long as the Pi isn't reading/writing important files when the power is pulled.

Your statement about Linux systems "Hating" having their power pulled is generally false. Think of all the devices in your life that run Linux that have their power pulled and never skip a beat...wireless routers, car computers, the RoboRIO, phones, Smart TV's.
__________________
John Fogarty
2010 FTC World Championship Winner & 2013-2014 FRC Orlando Regional Winner
Mentor FRC Team 1102 M'Aiken Magic
"Head Bot Coach" FTC Team 11444 Garnet Squadron
Former Student & Mentor FLL 1102, FTC 1102 & FTC 3864, FRC 1772, FRC 5632
2013 FTC World Championship Guest Speaker
  #6   Spotlight this post!  
Unread 12-02-2016, 11:37
techhelpbb's Avatar
techhelpbb techhelpbb is offline
Registered User
FRC #0011 (MORT - Team 11)
Team Role: Mentor
 
Join Date: Nov 2010
Rookie Year: 1997
Location: New Jersey
Posts: 1,620
techhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond repute
Re: Shutting Down a Robot-Mounted Pi

Quote:
Originally Posted by JohnFogarty View Post
Our team is using a Pi on our robot this year and found that issues with corruption don't exist, as long as the Pi isn't reading/writing important files when the power is pulled.

Your statement about Linux systems "Hating" having their power pulled is generally false. Think of all the devices in your life that run Linux that have their power pulled and never skip a beat...wireless routers, car computers, the RoboRIO, phones, Smart TV's.
Did you consider the swap file when you wrote this?

http://raspberrypimaker.com/adding-s...e-raspberrypi/
  #7   Spotlight this post!  
Unread 12-02-2016, 12:31
dc74089's Avatar
dc74089 dc74089 is offline
Control Systems Lead
AKA: Dominic
FRC #1902 (Exploding Bacon)
Team Role: Programmer
 
Join Date: Dec 2013
Rookie Year: 2011
Location: Orlando
Posts: 25
dc74089 will become famous soon enough
Re: Shutting Down a Robot-Mounted Pi

Quote:
Originally Posted by techhelpbb View Post
Did you consider the swap file when you wrote this?

http://raspberrypimaker.com/adding-s...e-raspberrypi/
Yes, most of the guides I followed on how to make the file system read only said to disable swap in the boot config.
__________________
-Dominic
Think big. Think smart. Think different.

FLL - Nerdvana (2011-12)
FTC - Nerdvana/Clockwork Mania 6379 (2012-13), Team HazMat 9277 (2014-?)
FRC - Clockwork Mania 4013 (2014), Exploding Bacon 1902 (2015-?)
  #8   Spotlight this post!  
Unread 12-02-2016, 11:28
anthonyttu anthonyttu is offline
Texas Instruments Engineer
AKA: Master Chief
FRC #5417 (Eagle Robotics)
Team Role: Mentor
 
Join Date: Aug 2008
Rookie Year: 2008
Location: Dallas
Posts: 61
anthonyttu has a spectacular aura aboutanthonyttu has a spectacular aura about
Re: Shutting Down a Robot-Mounted Pi

Is there a specific reason you want the Pi to be powered off when the robot is turned off?
I read the rules as you would be allowed to have an additional battery on the robot to power the Pi alone.


According the R31
"Additionally, batteries integral to and part of a COTS computing device or self-contained camera are also permitted (e.g. laptop batteries, GoPro style camera, etc.), provided they’re only used to power the COTS computing device and any peripheral COTS USB input devices connected to the COTS computing device and they are securely fastened to the ROBOT."
  #9   Spotlight this post!  
Unread 12-02-2016, 11:31
techhelpbb's Avatar
techhelpbb techhelpbb is offline
Registered User
FRC #0011 (MORT - Team 11)
Team Role: Mentor
 
Join Date: Nov 2010
Rookie Year: 1997
Location: New Jersey
Posts: 1,620
techhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond repute
Re: Shutting Down a Robot-Mounted Pi

Quote:
Originally Posted by anthonyttu View Post
Is there a specific reason you want the Pi to be powered off when the robot is turned off?
I read the rules as you would be allowed to have an additional battery on the robot to power the Pi alone.


According the R31
"Additionally, batteries integral to and part of a COTS computing device or self-contained camera are also permitted (e.g. laptop batteries, GoPro style camera, etc.), provided they’re only used to power the COTS computing device and any peripheral COTS USB input devices connected to the COTS computing device and they are securely fastened to the ROBOT."
Can you show me where you bought a Raspberry PI with an integral battery?
Integral means like the battery that comes with your laptop.

This topic has been done extensively elsewhere on the forum.
Adding a battery to the Raspberry PI violates the rules unless you can buy a package from somewhere that has the PI and the battery packaged together. That source (store) needs to be able to sell to the general public.
  #10   Spotlight this post!  
Unread 12-02-2016, 11:39
engunneer's Avatar
engunneer engunneer is online now
Alumni turned Mentor
AKA: Branden Gunn
FRC #4761
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1996
Location: Reading, MA
Posts: 783
engunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond repute
Re: Shutting Down a Robot-Mounted Pi

The issue is not with linux but the SD card. R-Pis have a tendency to bork the SD file system if shut down at the wrong time. I recommend to my students to have a complete clone of the working system SD card, which NEVER goes in a Pi. If the one in the Pi gets corrupted, reclone the master copy on to it, and everything is exactly as it was.

the master is made by taking the latest working pi card and shutting down properly before cloning to master. when doing software updates, have two masters. one is the last working rev, and the other is the current working rev.

Also, faster and more expensive SD cards tend to corrupt less (anecdotally)

Lastly, to answer the OP, I'd send a signal from the roboRio to the Pi at end of match to request a clean shutdown, then it will be powered down by the time you get to your robot during field reset. Most other cases can be covered by the onboard power switch linked to above. You still will have cases of unexpected power loss, but the less often it happens, the better.

knowing how long your electronics take to boot and shutdown nicely is really important.
__________________
Student FRC23 (1996-1999), Mentor FRC246 (2000), Mentor FRC1318 (2007-2009), Mentor FRC93 (2011), Mentor FRC2151 (2012), Mentor FRC23 (2013), Mentor FRC4761 (2014-2017)
1998 - National Chairman's Award and Woodie Flowers Award (FRC23, Mike Bastoni ) | 2007 - PNW SF (488, 1595) | 2008 - Oregon RCA - Seattle #2 Seed, SF (488, 1696) | 2009 - Oregon #1 Seed, Winners (1983, 2635) - Seattle SF (945, 2865) - Galileo #2 Seed, SF (973, 25) | 2012 Midwest F (111, 71) | 2014 RIDE Winners (78, 125), Inspector - NEU #24, QF (3479, 3958) - NECMP #35 | 2015 Reading #11, SF (1058, 190), Inspector - RIDE #17, QF(4055, 5494), Inspector - NECMP #57 | 2016 Reading #4, SF (133, 4474), DCA, Inspector - Ride #22, SF (1735, 2067), Creativity, Inspector - NECMP #48, RCA - Archimedes
  #11   Spotlight this post!  
Unread 12-02-2016, 12:34
anthonyttu anthonyttu is offline
Texas Instruments Engineer
AKA: Master Chief
FRC #5417 (Eagle Robotics)
Team Role: Mentor
 
Join Date: Aug 2008
Rookie Year: 2008
Location: Dallas
Posts: 61
anthonyttu has a spectacular aura aboutanthonyttu has a spectacular aura about
Re: Shutting Down a Robot-Mounted Pi

Quote:
Originally Posted by techhelpbb View Post
Can you show me where you bought a Raspberry PI with an integral battery?
Integral means like the battery that comes with your laptop.

This topic has been done extensively elsewhere on the forum.
Adding a battery to the Raspberry PI violates the rules unless you can buy a package from somewhere that has the PI and the battery packaged together. That source (store) needs to be able to sell to the general public.

All of these teams have 3D printers and are not interested in a revenue source entrepreneurs award.

If nobody wants to jumps on this I'll start a company tomorrow to sell you one.
  #12   Spotlight this post!  
Unread 12-02-2016, 12:50
techhelpbb's Avatar
techhelpbb techhelpbb is offline
Registered User
FRC #0011 (MORT - Team 11)
Team Role: Mentor
 
Join Date: Nov 2010
Rookie Year: 1997
Location: New Jersey
Posts: 1,620
techhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond repute
Re: Shutting Down a Robot-Mounted Pi

Quote:
Originally Posted by anthonyttu View Post
All of these teams have 3D printers and are not interested in a revenue source entrepreneurs award.

If nobody wants to jumps on this I'll start a company tomorrow to sell you one.
Need a website and other stuff to prove you have a proper business for the general public. It's not actually that hard: I just am too busy with other things to sell an assembled Raspberry PI in the case with the battery to someone.

Worse there's nothing stopping someone then from placing a really big order which means unless you have a large pile of the Raspberry PI handy...
  #13   Spotlight this post!  
Unread 12-02-2016, 13:59
anthonyttu anthonyttu is offline
Texas Instruments Engineer
AKA: Master Chief
FRC #5417 (Eagle Robotics)
Team Role: Mentor
 
Join Date: Aug 2008
Rookie Year: 2008
Location: Dallas
Posts: 61
anthonyttu has a spectacular aura aboutanthonyttu has a spectacular aura about
Re: Shutting Down a Robot-Mounted Pi

Quote:
Originally Posted by techhelpbb View Post
Need a website and other stuff to prove you have a proper business for the general public. It's not actually that hard: I just am too busy with other things to sell an assembled Raspberry PI in the case with the battery to someone.

Worse there's nothing stopping someone then from placing a really big order which means unless you have a large pile of the Raspberry PI handy...

So you say I'm almost guaranteed to sell a few hundred to prove I can keep up with demand? I'm not hearing the problem.

Adafruit will sell me 85 per order
  #14   Spotlight this post!  
Unread 12-02-2016, 14:26
techhelpbb's Avatar
techhelpbb techhelpbb is offline
Registered User
FRC #0011 (MORT - Team 11)
Team Role: Mentor
 
Join Date: Nov 2010
Rookie Year: 1997
Location: New Jersey
Posts: 1,620
techhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond reputetechhelpbb has a reputation beyond repute
Re: Shutting Down a Robot-Mounted Pi

Quote:
Originally Posted by anthonyttu View Post
So you say I'm almost guaranteed to sell a few hundred to prove I can keep up with demand? I'm not hearing the problem.

Adafruit will sell me 85 per order
What are you waiting for
Are you done yet? (quoting an old college professor 10 minutes into every test)
Can we buy one?

Remember you need a way to charge that integrated battery as well.
If you sell this under COTS there's no minimum sale requirement - just that people in general can buy them.
If you take this product into FIRST approval that's a more complex and lengthy process you will not complete this season.

Last edited by techhelpbb : 12-02-2016 at 14:33.
  #15   Spotlight this post!  
Unread 12-02-2016, 14:37
Hjelstrom's Avatar
Hjelstrom Hjelstrom is offline
Mentor
FRC #0987 (High Rollers)
Team Role: Mentor
 
Join Date: Mar 2008
Rookie Year: 2005
Location: Las Vegas
Posts: 146
Hjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond reputeHjelstrom has a reputation beyond repute
Re: Shutting Down a Robot-Mounted Pi

In 2012 we used a linux single-board computer on our robot and had to solve the shutdown problem. There are some details in this document:

http://www.chiefdelphi.com/forums/sh...ght=Kinect+987

Our final solution assumes that you've written a program on your vision processing computer that can respond to packets it recieves from the RoboRio or other computers. Our robot computer (crio at the time) sent a packet to the vision co-processor which caused it to run the shutdown script. We triggered all of this with a button on one of the joysticks at the drive station. For what it is, it was a lot of work to get right but we didn't want that 1 in a million chance of our vision computer corrupting its file system at the wrong time.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:54.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi