Using sensors to track relative pose
In this section, we will explore what a pose is, how to create, send, and display poses, and how to move the poses relative to the movement of the robot.
Setting up poses
We’ll make some random poses in robot/code.py using NumPy, a numeric manipulation library for fast array operations, with ulab providing this functionality in CircuitPython. This library also gives us handy ways of storing and dealing with arrays.
Import the ulab library, and random to generate random poses:
import asyncio import json import random from ulab import numpy as np
After the read_json function, we’ll add a Simulation class to hold the poses:
class Simulation: def __init__(self): self.population_size = 20 self.poses = np.array( [( ...