-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save demonstrations and video snapshots to firebase #36
Comments
I'm currently working on implementing the new data storage format in firebase. It is based on how we saved data for the cursor-based teleoperation project: https://github.com/mayacakmak/se2/blob/master/scripts/database.js The system is categorized by user, session, demonstration, and action
// Users contains only meta info about each user such as session start time
// and any other information we need to save about them
// This is stored under each user's unique ID
"users": {
"u1": {
"s1": {
"date": "Wed Jun 10 2020",
"time": "11:45:13 GMT-0700 (Pacific Daylight Time)",
"timestamp": 1591814713656
"demonstrations": ["d1", "d2", ...]
}
},
"u2": { ... },
"u3": { ... }
},
// Demonstrations and actions are separated from users
// so we can still query individual events easily
"demonstrations": {
"d1": {
"a1": {
"date": "Thu Jun 27 2019",
"eventName": "GripperOpen",
"eventInfo": "medium",
"time": "16:40:27 GMT-0700 (Pacific Daylight Time)",
"timeStamp": 1561678827981
},
"a2": { ... },
"a3": { ... }
},
"d2": { ... },
"d3": { ... }
} Firebase tends to work best with flatter data structures because it allows querying of individual demonstrations without needing to download all of them. We ran into some issues on the previous project where too much depth resulted in massive files that were difficult to download. Note: This is technically a bit insecure since any user who is logged in has permission to write to all of |
Image snapshotting is functional, but I'm not sure if we want to use it. One frame from one camera is around 20kB. So 20 kB x 3 cameras x 1 image per second x 1 mins is 3.6 megabytes per minute or 216 megabytes per hour. That is a fair amount of data to save to firebase realtime, and even with the flattened data structure would likely slow it down (especially if we do lots of demonstrations). The free firebase plan only allows 1 gb of storage, so we would probably fill that up pretty quickly. If we only save data when a certain action is triggered (ex start/stop demonstration) or only save on camera, it would help, but it may be better to think about alternative methods. We could look at saving the demonstrations locally, or save it to the firestore database instead of the firebase realtime database (this would probably require paying a bit extra). |
We need to be able to save snapshots (or even entire videos) as part of the initial demonstration. One option is to base64 encode the image and save that in firebase, we might also want to look a local way to save the data (the interface already has WebRTC video saving setup)
The text was updated successfully, but these errors were encountered: