Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Technical Discussion (http://www.chiefdelphi.com/forums/forumdisplay.php?f=22)
-   -   Shutting Down a Robot-Mounted Pi (http://www.chiefdelphi.com/forums/showthread.php?t=143690)

techhelpbb 12-02-2016 13:48

Re: Shutting Down a Robot-Mounted Pi
 
Quote:

Originally Posted by JohnFogarty (Post 1539204)
I searched, where is this discussion? Where's the QA question?

http://www.chiefdelphi.com/forums/sh...hlight=battery

Also this from me in that topic:
http://www.chiefdelphi.com/forums/sh...1&postcount=45

See later pages there are others on the forum about this.
I don't have my fingers on the old official QA you'd have to dig that up and look but I meant this forum when I wrote this:
"This topic has been done extensively elsewhere on the forum."

If I really need to I am sure I can dig up that old e-mail from FIRST headquarters.

JohnFogarty 12-02-2016 13:51

Re: Shutting Down a Robot-Mounted Pi
 
Quote:

Originally Posted by techhelpbb (Post 1539206)
http://www.chiefdelphi.com/forums/sh...hlight=battery

See later pages there are others on the forum about this.
I don't have my fingers on the old official QA you'd have to dig that up and look but I meant this forum when I wrote this:
"This topic has been done extensively elsewhere on the forum."

I literally typed the title of that thread and it didn't come up. Wow, thanks.

anthonyttu 12-02-2016 13:59

Re: Shutting Down a Robot-Mounted Pi
 
Quote:

Originally Posted by techhelpbb (Post 1539184)
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

JesseK 12-02-2016 14:22

Re: Shutting Down a Robot-Mounted Pi
 
I don't know the RoboRIO ecosystem, but I do know Linux and Java.

Code:

ssh user:password@rpihost 'sudo shutdown -h now'
You're possibly better off putting the shutdown command into a shell script so you can attempt to kill the processes 'nicely' first, then issue the shutdown - all within the script. The script would live on the raspberry pi, so your RoboRIO code doesn't have to care how the R-PI stuff shuts down, ever.

Add this when you detect end of match presuming you go the script route:
Code:

java.lang.ProcessBuilder processBuilder = new java.lang.ProcessBuilder("ssh", "user:password@rpihost","/path/to/script.bash");
java.lang.Process p = pb.start();
p.waitFor(); // WARNING - will block this thread.  Also, will only block this thread.
System.out.println("R-PI shutdown executed");


techhelpbb 12-02-2016 14:26

Re: Shutting Down a Robot-Mounted Pi
 
Quote:

Originally Posted by anthonyttu (Post 1539212)
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 :D
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.

Hjelstrom 12-02-2016 14:37

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.

JohnFogarty 12-02-2016 16:49

Re: Shutting Down a Robot-Mounted Pi
 
Has anyone looked into the legality of this?

http://www.modmypi.com/raspberry-pi/...dules/ups-pico

I'm going to ask on the Q&A myself tonight.

techhelpbb 12-02-2016 17:03

Re: Shutting Down a Robot-Mounted Pi
 
Quote:

Originally Posted by JohnFogarty (Post 1539313)
Has anyone looked into the legality of this?

http://www.modmypi.com/raspberry-pi/...dules/ups-pico

I'm going to ask on the Q&A myself tonight.

What worries me about that is the battery does not appear to have a fuse between it and the rest of the system. So that's the sort of battery I wouldn't want to overload and there are exposed pins that could overload that battery all over the place.

engunneer 13-02-2016 00:09

Re: Shutting Down a Robot-Mounted Pi
 
I await the Q&A response, but I expect this would not be legal, as it's not integral to the cots computing device. It's an add-on, but I suspect it is just outside the line. Could be an interesting option if they rule it legal.

viggy96 13-02-2016 00:30

Re: Shutting Down a Robot-Mounted Pi
 
Quote:

Originally Posted by dc74089 (Post 1539105)
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?

That statement regarding Linux systems is fasee. If anything, Windows cares about having its power pulled. Linux couldn't care less. I have dealt with a variety of Linux distributions, and have unplugged, forced shutdown many of them. Linux doesn't care, it just works. Linux FTW.

Foster 13-02-2016 01:10

Re: Shutting Down a Robot-Mounted Pi
 
/sigh. No computer system that I've used from mainframes to Raspberry Pi, from MCP to Unix, including Windows and Linux deals well with hard power off when there are IOs in process. You've been lucky.

Lots of people have borked the SD card in a Raspberry Pi. The OP asked a good question, and people are trying to help. Your "whistling in the dark" isn't productive and I predict that someday you will either spend the night hand sewing inodes to restore a file system, or spend most of the day hoping your backup system really works while you boss yells at you about lost orders.

Jared 13-02-2016 01:56

Re: Shutting Down a Robot-Mounted Pi
 
Quote:

Originally Posted by viggy96 (Post 1539491)
That statement regarding Linux systems is fasee. If anything, Windows cares about having its power pulled. Linux couldn't care less. I have dealt with a variety of Linux distributions, and have unplugged, forced shutdown many of them. Linux doesn't care, it just works. Linux FTW.

Please don't give out misleading information on the internet based off of personal experience. The raspberry pi has documented issues that occur when power is cut, and it runs Linux.

The issues is more about hardware than software. The FTL (flash transition layer) will remap storage on the fly as part of its wear leveling feature. If you kill power during a remapping, you pretty much lose the whole disk. This is different from flash storage on something like a roboRIO or a wireless router, which doesn't have that additional layer of abstraction.

Linux does care when its file system is no longer usable.

viggy96 18-02-2016 07:35

Quote:

Originally Posted by Jared (Post 1539514)
Please don't give out misleading information on the internet based off of personal experience. The raspberry pi has documented issues that occur when power is cut, and it runs Linux.

The issues is more about hardware than software. The FTL (flash transition layer) will remap storage on the fly as part of its wear leveling feature. If you kill power during a remapping, you pretty much lose the whole disk. This is different from flash storage on something like a roboRIO or a wireless router, which doesn't have that additional layer of abstraction.

Linux does care when its file system is no longer usable.

Quote:

Originally Posted by Foster (Post 1539501)
/sigh. No computer system that I've used from mainframes to Raspberry Pi, from MCP to Unix, including Windows and Linux deals well with hard power off when there are IOs in process. You've been lucky.

Lots of people have borked the SD card in a Raspberry Pi. The OP asked a good question, and people are trying to help. Your "whistling in the dark" isn't productive and I predict that someday you will either spend the night hand sewing inodes to restore a file system, or spend most of the day hoping your backup system really works while you boss yells at you about lost orders.

Hmmmm... Let's see, first, was referring purely to the software when I made those statements, not the hardware, and yes you can run into issues dealing with the SD card if the power is suddenly cut, IN SOME CASES. If you have set it up, correctly, and are using it as a vision co-processor, all you are doing is cutting the power while a programme is running. I have done exactly this hundreds, actually thousands, of times, with a Pi B+. I have used it for vision, and just unplugged it to turn it off. Every time, it booted correctly the next time I needed it. Of course, during setup, I made sure to never to that.

So please folks, don't question my intelligence.

JesseK 18-02-2016 10:10

Re: Shutting Down a Robot-Mounted Pi
 
Quote:

Originally Posted by JesseK (Post 1539219)
Code:

ssh user:password@rpihost 'sudo shutdown -h now'

Sorry to quote myself, but this thread has devolved a bit and I really do wonder if a software solution is plausible. This 'ssh' works well for a few things at work, but I don't know if the RoboRIO/R-PI setup allows for it (firewall/sudo permissions/etc).

We're toying with a few auto-shutdown features in our own code, but detecting the end of match (rather than disabling of robot) is proving a little tricky.

techhelpbb 18-02-2016 10:24

Re: Shutting Down a Robot-Mounted Pi
 
Quote:

Originally Posted by viggy96 (Post 1542120)
Hmmmm... Let's see, first, was referring purely to the software when I made those statements, not the hardware, and yes you can run into issues dealing with the SD card if the power is suddenly cut, IN SOME CASES. If you have set it up, correctly, and are using it as a vision co-processor, all you are doing is cutting the power while a programme is running. I have done exactly this hundreds, actually thousands, of times, with a Pi B+. I have used it for vision, and just unplugged it to turn it off. Every time, it booted correctly the next time I needed it. Of course, during setup, I made sure to never to that.

So please folks, don't question my intelligence.

It is possible if you are running Arch Linux with the swap file OFF that your systems will only be writing to storage when and if your application writes to storage. Raspbain quite often has swap enabled and written to the SD card. Depending on how swappiness (yes that's not made up it's a real thing) is setup your kernel may or may not use that swap if the memory space of your application starts to use up too much of the system's actual RAM.

This is not to question to you, or anyone's intelligence, just a point that currently I have 50,000+ copies of Linux online and running in various public and private clouds and datacenters. The smart thing to do is do a proper shutdown unless you know for a fact you've controlled the risk or have no better option.

For example I used to take Dell OptiPlex systems I had as leftovers from upgrades and put Ubuntu on them. Mess with the disk settings to spin down the hard drives and spin them up only on demand or every 6 hours (which ever was first and then spin them back down in 5 minutes). I would increase the write cache large enough that casual writes would come back from memory. I would remove the swap so that would not qualify to spin up the hard drive. Most of the drives lasted beyond 8 years and those that did not were already questionable (had de-allocated bad sectors that weren't mapped at the factory). These systems were used for print server farms like a giant version of the HP JetDirect driving down the cost of the printers because we could print to CUPS raw queues from Windows happily.

So again - there's plenty of simple ways shown here to accomplish this task from using a button and a script or SSH.
Why run any risk you don't need to?
Unlike other applications out there you really might take the chance you have an issue in the next match that hurts your competitive edge.


All times are GMT -5. The time now is 21:07.

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