Skip to content
This repository was archived by the owner on Oct 8, 2024. It is now read-only.

Update vision to (mostly) match Zoloto - #352

Merged
PeterJCLaw merged 18 commits into
masterfrom
update-vision
Oct 21, 2022
Merged

Update vision to (mostly) match Zoloto#352
PeterJCLaw merged 18 commits into
masterfrom
update-vision

Conversation

@PeterJCLaw

@PeterJCLaw PeterJCLaw commented Oct 21, 2022

Copy link
Copy Markdown
Member

This updates the vision API to mostly match the portions of Zoloto which are exposed by the sr.robot3 API. The main exception here is that orientation data is different to Zoloto as well as having an incomplete API. There's probably enough here to be useful for Kickstart though.

For reference, RealOrangeOne/zoloto#312 adds documentation to the Zoloto types for what their axes are and it's that PR that I've used as reference for what the simulator should do.

I'm hoping that we can fully re-evaluate the state of the vision API after Kickstart and end up with the two APIs in agreement. For now the simulator emits a warning about the differences if the relevant code is used.

As part of this change I've reinstated the arena wall markers, though note that the approach for these is a bit different now, added a camera to the robot and also added markers to one of the token types (again see details below).

This also changes how the vision system approaches markers. In particular there is support here for flat (i.e: essentially zero-width) markers which are distinct from the object they are attached to. This means that all markers are now achieved like wall markers -- as a separate entity attached to the face where we want a marker. In turn this enables having different sized markers than the objects they're on, allowing for better modelling at the expense of slightly more effort in setting up the models.

This fixes #83 but trades off against less accurate occlusion handling as our vision system no longer knows the size of the object. This feels like the right trade-off given the Webots ought to be doing the occlusion anyway, so if we want to change that we should look to configure it better there. In general this change pushes more of the physical modelling into Webots, which is probably a good thing.

To aid with the modelling there are now a series of PROTO files here which add the models for the markers. For demonstration purposes, I've done the addition to the "Gold" token that remained from previous years and added a couple of them to the arena.
They now more obviously have a marker on them, though even better might be to find an actual marker texture we can use there.

For anyone developing an arena, the main changes are that the model of a marker should now always match F\d{2} in order to indicate that it is one of the newer style flat markers. Support for the older "box" style remains, as B\d{2}, though we should remove that at some point.

The SR vision API now uses radians due to moving to `zoloto`.
This commit does not change the shape of the API, just the units,
so that the API shape changes can happen separately.

This converts all computation and APIs, however keeps degrees in
the tests and other places where humans need to eyeball the numbers
to understand them.
Previously this information was provided via the API, however it
isn't any more. Our vision logic does need some handling for this
so we keep some basic support for it internally.
This has some places where we're missing stuff, as well as places
where we're not yet computing the right values, however this mostly
gets the types into the right shapes.

Given Zoloto's limitations around Spherical types I've kept our
existing PolarCoords type around for now.
@PeterJCLaw
PeterJCLaw marked this pull request as ready for review October 21, 2022 14:29
@PeterJCLaw
PeterJCLaw requested a review from Adimote October 21, 2022 14:29
This probably isn't the ideal robot to be using, but it's the one
that's here.
This is based on how they were previously, with tweaks to update
them for the latest webots and ensure they're in the right positions
in the arena.
This isn't perfect, as bigger markers ought to be visible from
further away, but is better than not limitting it.
This changes how we filter these out and now relies on the
orientation of the object in Webots, however there were already
couplings between the marker definitions and the code so this
shouldn't be an issue.
This presents a much more cohesive approach which should match how
markers will behave in reality rather than assuming that they're
cubes. For speed I've left a lot of the existing naming alone
even though it's now a bit confusing.
This is unlikely to be important at Kickstart and as long as it's
clear that it could change, fixing it later allows us to prioritise
other things right now.
@PeterJCLaw
PeterJCLaw merged commit d4a7e50 into master Oct 21, 2022
@PeterJCLaw
PeterJCLaw deleted the update-vision branch October 21, 2022 19:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validate apparent size/distance of token makers

2 participants