-
Notifications
You must be signed in to change notification settings - Fork 1
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
Shepherd Overhaul #42
Comments
The only way I can think to wait for start without the user code being able to init the robot lib is to be able to is to have every method of the robot lib call a "wait_for_start" which just passes if the start button has already been pressed. That way we will load the robot lib but stop normally at the first robot lib call for the start button to be pressed should you want to wait for start you would do something like the following: import robot as R
R.bypass_wait_for_start()
R.servos[0] = 20;
R.servos[1] = 34;
R.wait_for_start()
while True:
print(R.see()) Metaclasses or decorators can be used to wrap the API surface like this. |
@shardros from your comment #38 (comment)
I feel like this should be possible using some form extreme of monkey patching.
Maybe a simplier way would be to have shepherd instanciate robot and then you just do: import robot as R
R.motors[1] = 100
R.see() The robot object lives within So the
It does feel weird but it does look nicer.
I see no problem in having the robot initiate when
Yea fun stuff is fun but theres still a danger of breaking stuff which rust would prevent. As long as we have an open enough API that allows users to do what they want and still stop them when they might break things, we should be okay. Having a "don't process" option on
Totally fair it was a pain to write, i think. |
What do you think of also overhauling sheep to be a vscode extension? Personally as long as sheep works and can be served staticlly I don't want to touch it. but it seems possible to host vscode locally now and it might be possible to get blockly working in vscode
|
vs-code has alot of button which students don't need and so I am concerned
that it is going to be more confusing. We want the minimal amount of
functionality. I think for power users a CLI is less effort for us and
better for them, see #40
…On Mon, 18 Apr 2022 at 23:17, Jack ***@***.***> wrote:
What do you think of also overhauling sheep to be a vscode extension?
Personally as long as sheep works and can be served staticlly I don't want
to touch it.
*but* it seems possible to host vscode locally now
- https://github.com/gitpod-io/openvscode-server
- https://github.com/coder/code-server
and it might be possible to get blockly working in vscode
-
https://marketplace.visualstudio.com/items?itemName=tobylai.vscodeblocklypython
although I can't find any source code or how they did it.
—
Reply to this email directly, view it on GitHub
<#42 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADFYNL3MXJFMQUTWNCJMUIDVFXNQHANCNFSM5TW32VQQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
There would be just one object in
Not sure we need to be too concerned about concurrency. All robot state is stored in shepherd. |
GPIO would only be used by shepherd |
It would also make running the user code just a bit faster as we wouldn't have to wait for the cameras to init etc each time which takes a second or so |
Could the majority of shepherd and the robot library be moved behind a socket interface? If you did that then sheep "go" would just message the socket, as would the start button. We could poll the relevant socket for state of GPIO, battery voltage etc. This would also open up the possibility of remote control. You'd need a different command to commit code for execution which would reload the usercode to complete the tasks that sheep does on run. A socket interface would also allow us a global "ABORT" from the arena, (as well as global "start", which we should not ever use because this responsibility has to sit with the competitors). Sheep is currently uncluttered. I wonder during any refactoring if the status of battery, servos, motor power, GPIO would be useful to expose for debugging. They would also make the arena status more interesting. |
I prototyped sending the image over a socket which I think would be the only remotely difficult thing in 2020: https://github.com/shardros/playing-with-sockets/
I think so. It would decouple issues between software and hardware. "X is not working" would be obvious weather the software was or was not setting it to a value. If it is too much clutter then we could always hide it The more I think about it the more I think that the robot object should live within shepherd. The only reason why we do |
its quite a effective way to force the robot to block on start push without telling the students they need to add extra code, so behaviorally it might still be worthwhile. The way that you have an "object" to operate on is quite nice when describing to people whats happening. From a user POV I think we should keep the same interface, but modify how it works in the background so that GG crashes don't cause user code crashes and vise-versa. Internally you don't have to pass an image over the socket interface, none of our competitors are really going to try to wrap their own image recognition, so you could pull all of the OpenCV code outside and have a "when socket is opened, take picture, digest, and spit out marker details". Its still nice for the arena to collect images this way, but we can do that with websockets, even if websockets are just saying "image.jpg?". We would end up with less flashing if we alternated though image<0-9>.jpg?. As the image is served over HTTP, if a team really wanted to they could fetch the image the same way. |
I agree, the default should be to have no additional code. I am suggesting that a call to robot.X will block untill the start button is pressed. A way of implementing this: class Robot():
def wait_for_start(func):
while not self.start_button_has_been_pressed:
pass
@self.wait_for_start
def see():
# Do stuff here We would need some way of disabling this behaviour so people could do things before start if they wanted but it makes the user code simpler. This gets rid of
I wasn't even really considering people doing their own vision stuff. Its more so we could write the bytes directly into where the image is in sheep rather than say "hey go get a new image you've never seen before" thereby getting rid of all the flickering even when
80% of GCSE students in RC do not know what an object is and for the 10% which this is explained to you still have an object. Its just we make a robot object for you and then give it to you with |
Coming from these comments:
Must Do:
shepherd
API using FastAPI (https://fastapi.tiangolo.com/)Might Do:
mock-shepherd
fromshepherd
The text was updated successfully, but these errors were encountered: