-
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
Saving arm poses and safely sending the robot to a pose #12
Comments
This issue depends on addressing Issue #16 first, since we'll need to remember poses saved by the user. We might want a separation of global poses ("stowed" "ready for manipulation") higher in the Firebase tree versus user's saved actions under the user branch of Firebase. |
Once we figure out the infrastructure for this and have stow/prep implemented (Issue #13) then we can figure out and implement the user interface for saving a pose (e.g. a button that says save current pose and a text field for naming the pose, perhaps in a popup) as well as sending the robot to a pose (e.g. dropdown menu with a list of all saved poses and a button "Send robot to pose"). |
This is a general update on the state of pose saving/loading right now OAuthGoogle OAuth is set up to allow users to log in with their email. I set it up as described in this comment (once the image issue is fixed we can probably close that issue). I am having some trouble loading the button image from the server, so right now it displays an empty image (worst case we can load it from an external source, but I think this is just a node.js configuration issue or I'm loading the wrong path here) Because the robot cannot access firebase, or the operator's OAuth login, more data needs to be passed from the operator to the robot when a pose is executed (I'll touch on this more later). DatabaseRefactorIn order to get OAuth working, I had to refactor most of the database code. I also updated the class syntax style. The biggest change is that it is now referenced using the local instance For example: stretch_web_interface/shared/commands.js Lines 57 to 64 in b737d6f
Pose SavingPoses are stored in two locations in firebase.
Each pose has an I added a few new functions to the database to manage poses.
Because there is no admin interface, the only way to add global poses currently is by entering them into firebase manually. Pose managerThe core of the front-end pose system is a the new It interfaces with firebase through
This is what it looks like when all the buttons are loaded (a, b, and c are just testing poses) Currently there is no visual difference between global and user poses, that could be added by changing the styling here Using existing posesAs previously mentioned, the robot cannot access firebase, this means that all of the pose joint data needs to be sent from the operator to the robot via the WebRTC connection. When any pose button is pressed, it calls moveToPose in stretch_web_interface/shared/commands.js Lines 192 to 199 in b737d6f
It is a bit ugly, but the Once the robot receives the pose info, it calls goToPose in In simulation, moving multiple joints at a time is much more complicated than on the actual robot, because each type of joint movement needs its own goal that has to be sent to a different rostopic. I completely rewrote generatePoseGoal to support this. It works in simulation, will likely need to be debugged on the actual robot. Adding new posesThe front end side of this is currently functional. When the When The problem is that the operator doesn't have access to the robot state, so it doesn't know what position each of the joints is in. The data that is currently being uploaded to firebase is just the state of the checkboxes which doesn't actually do anything. What I was planning on doing nextThe biggest thing is probably setting up communication between the operator and robot, so that the operator can request specific pose data from the robot and then upload it to firebase. Once this is working, the full pose pipeline should be complete. I think we had also talked about implementing a deadman's switch so that either the operator had to hold down a button until stretch is done moving to a pose, or at any time before it is done, the operator can click to cancel. I was planning on looking into the goal's Finally the node.js image thing is probably an easy fix, my understanding is that we are serving /shared as a static directory (https://github.com/hcrlab/stretch_web_interface/blob/save_poses/routes/index.js#L30), and we're correctly loading js files from there, so I'm not sure why images won't work. |
Communication between the operator and robot browsers is working now! Most of it is handled in the new file request_response.js which facilitates data fetching between the two browsers, so either request info from the other. Details on the request/response protocol: Request Format {
type: 'request', // Message type
id: "", // Unique id (for poses, this is the pose id)
requestType: "", // The type of data that is being returned (For poses this is "jointState")
responseHandler: "" // The response handler (for poses this is "poseManager"
} Response Format {
type: "response", // Message type
id: "", // Unique id (for poses, this is the pose id)
responseHandler: "", // The response handler (for poses this is "poseManager"
responseType: "", // The type of data that is being returned (For poses this is "jointState")
data: {} // Response data
} The The response handler code checks that the On the responding side, as soon as a request is received by respondToRequest, a response is generated and sent back. On the requesting side, each request is made in the form of a promise, that is automatically fulfilled when the response is received (this is what the Using promises means that the code that works with the response requests (in this case Currently, all the promise code is handled within operator_pose.js, but this will create a lot of code duplication in the future if we ever want to use this protocol for more request/response communication. To solve this I think a Pose saving is handled with asynchronous functions getRobotState() (which returns the promise of the response) and addPose() (which saves the current robot state to firebase with the other necessary pose info) in operator_pose.js. Next Steps:
|
As a basis of two functionalities requested by Henry (automatic stow/prep and automated robot motions) we need to be able to save the state of the robot arm (position of each joint) and then send the robot to a previously saved pose.
We can look into the arm stowing script for how that is handled.
We might want to have poses saved on Firebase.
We might need to be extra cautions during execution of the movement, going from an arbitrary current pose to a saved pose.
The text was updated successfully, but these errors were encountered: