Here again with another sandbox question. What is the easiest way to pull the ID of the April Tag when it is detected? The easiest to me seems to be AvrApriltagsSelectedPayload, but this has been commented out in fusion. It reads:
# uncomment to re-enable position re-syncing
# currently not well enough tested/reliable to be competition ready
# "avr/apriltags/selected": self.on_apriltag_message
Would uncommenting this work or would this cause a problem?
Thanks!
Take a look at the following topic: avr/apriltags/visible
It will contain a list of the following objects:
class AvrApriltagsVisibleTags(TypedDict):
id: int
"""
The ID of the AprilTag
"""
horizontal_dist: float
"""
The horizontal scalar distance from vehicle to AprilTag, in centimeters
"""
vertical_dist: float
"""
The vertical scalar distance from vehicle to AprilTag, in centimeters
"""
angle_to_tag: float
"""
The angle formed by the vector pointing from the vehicles body to the AprilTag in world frame relative to world-north
"""
heading: float
"""
The heading of the vehicle in world frame
"""
pos_rel: AvrApriltagsVisibleTagsPosRel
"""
The relative position of the vehicle to the tag in world frame in centimeters
"""
pos_world: AvrApriltagsVisibleTagsPosWorld
"""
The position of the vehicle in world frame in centimeters (if the tag has no truth data, this will not be present in the output)
"""
There is a key called “id” which contains what you appear to be asking for
I tried this but kept getting errors in vs code. Here is what it looks like. We also are having a problem with it trying to run the code again every time the csi camera updates the payload.
I figured out that on_april_message worked for this. Is there a way that you can provide documentation for what we can use? It is extremely hard to figure out what works and anything that records these is helpful.
All the red squiggles you see are nothing but mere suggestions. You can ignore them, unless you want to go down the rabbit hole of Python type hinting. To disable these warnings, in VS Code you can go to Python → Analysis: Type Checking Mode and turn it to “off”:
On PyPi: bell-avr-libraries · PyPI, I tried to have auto-generated documentation on all the MQTT topics available and the data types that are sent and recieved on them.