---
# System prepended metadata

title: Encoding Equivariance (Part 2)

---

# Encoding Equivariance (Part 2)

## Adding Magnitude of Velocity Vector

Adding the magnitude of the U1's velocity vector greatly changes the shape of the predicted force function. In general, drones that make quick passes under U2 experience only an outward "push" force, whereas those that make slower passes also experience a "pull" force after the "push" force.
![](https://i.imgur.com/17N7Y3G.png)

![](https://i.imgur.com/mEQGV5w.png)


## On Model Training

![](https://i.imgur.com/k5qUTEQ.png)
![](https://i.imgur.com/JI5UWkP.png)


**Right now**:
Loss is minimized very early-on in training, but our model does not overfit to the noise (approximately $0.2 m/s^2$). The validation loss is only slightly larger than the training loss.

**What this means**: 
Our function class is not too rich, since otherwise we would overfit to the training data and the validation loss would be large. This is a result of the spectral normalization mentioned last week.

## Force Prediction Model (Nonstationary Leader Drone)
Previously, we assume that the top drone is stationary (i.e. has $\mathbf{v}^{(2)} = \mathbf{0}$), and so there is an axis of rotational symmetry that corresponds to $\mathbf{d} = (0,0,-1)^T$.

As Jennifer and Ajay keenly pointed out, this will change once $\Vert \mathbf{v}^{(2)} \Vert_2 \gg 0$. First, the axis of symmetry will depend upon the velocity vector of the top drone. Secondly, the force function will not necessarily be rotationally symmetric about this axis. Instead, as we will illustrate, we only get symmetry about a halfspace.

We discuss how we will model the sufferer drone's forces in this case:

1. The velocity vector of the top drone, $\mathbf{v}^{(2)}$, determines its deck angle, $\xi$. Then we can find the unit vector $\tilde{\mathbf{v}}$ that lies in the plane $\mathcal{H} = \text{span}\{\mathbf{v}^{(2)}, \mathbf{d}\}$ and has angle $\xi$ with $\mathbf{v}^{(2)}$.
![](https://i.imgur.com/55nrBgl.png)

2. This vector $\tilde{\mathbf{v}}$ becomes the first in an orthonormal basis we will construct. So long as $\langle \mathbf{v}^{(2)}, \mathbf{d} \rangle \neq 0$, then $\mathcal{H}$ contains a unit vector $\mathbf{w}_1$ which is orthogonal to $\tilde{\mathbf{v}}$. We complete our orthonormal basis by finding the unit normal vector to $\mathcal{H}$: $\mathbf{w}_2 = \tilde{\mathbf{v}} \times \mathbf{w}_1/\Vert \tilde{\mathbf{v}} \times \mathbf{w}_1 \Vert_2$. 
    
    Now we can convert any vector $\mathbf{x}$ in the standard basis to our new basis $\{\tilde{\mathbf{v}}, \mathbf{w}_1, \mathbf{w}_2 \}$ according to $$\mathbf{B} \mathbf{x}, \quad \mathbf{B} = [\tilde{\mathbf{v}}, \mathbf{w}_1, \mathbf{w}_2]^T.$$ Note that $\mathbf{B}$ is an orthogonal matrix, and so we can efficiently convert back to original coordinate system according to $\mathbf{B}^{-1} = \mathbf{B}^T$.
    
    In particular, let us fix a value along the $\tilde{\mathbf{v}}$ axis and consider the bottom, drone's position in the $\mathbf{w}_1-\mathbf{w}_2$ plane. The cross section of the force function with this plane is a circle.
    
    This brings us to two possible formulations of the model's symmetry. First, similar to the stationary case, we can assume rotational symmetry about the $\mathbf{w}_1-\mathbf{w}_2$ axes. Therefore, we parameterize the force function on this plane according to (1) the magnitude of the drones' relative position vector and (2) the cosine of the angle between the relative position vector and sufferer drone's velocity vector. 

    Assuming rotational symmetry seems reasonable for small velocity vectors $\mathbf{v}^{(2)}$.

![](https://i.imgur.com/fR36XtK.jpg)

3. Otherwise, we only assume that the true force function on this plane is symmetric only about the axis $\mathbf{w}_2$. 
    
    In this case, we parameterize the force function evaluated on this plane according to (1) the angle the sufferer drone's relative position vector forms with the $\mathbf{w}_1$ axis, (2) the magnitude of the drones' relative position vector, and (3) the absolute angle (not the cosine) between the relative position vector and the sufferer drone's velocity vector.
![](https://i.imgur.com/v7QhAMk.png)

4. This neural network maintains the same rotational equivariance properties as the geometric graph neural network (geometric GNN) with two nodes: $$f_{\Theta}(\mathbf{R}\mathbf{v}) = \mathbf{R}f_{\Theta}(\mathbf{v}), \quad \mathbf{v} = [\mathbf{v}^{(1)}, \mathbf{v}^{(2)}, \Delta \mathbf{p}]^T,\quad  \mathbf{R} \in H \leq G = \text{SO}(3),\quad H \cong SO(2).$$
    ![](https://i.imgur.com/GIiZLYR.jpg)
    
    But if we assume rotational symmetry about $\tilde{\mathbf{v}}$, we get stronger equivariance properties. In particular, we also have $$f_{\Theta}(\tilde{\mathbf{R}} \mathbf{v}^{(1)}, \tilde{\mathbf{R}} \Delta \mathbf{p}, \mathbf{v}^{(2)}) = \tilde{\mathbf{R}}f_{\Theta}(\mathbf{v}^{(1)}, \Delta \mathbf{p}, \mathbf{v}^{(2)}),\quad  \tilde{\mathbf{R}} \in \tilde{H} \leq \tilde{G} \cong \text{SO}(3),\quad \tilde{H} \cong SO(2),$$ where $\tilde{G}$ is the group of three-dimensional rotations about the axes $\tilde{\mathbf{v}}-\mathbf{w}_1-\mathbf{w}_2$ and $\tilde{H} \leq \tilde{G}$ are those rotations in $\tilde{G}$ that fix the $\tilde{\mathbf{v}}$ axis. Clearly, $G \cong \tilde{G} \cong \text{SO}(3)$ and $H \cong \tilde{H} \cong \text{SO}(2)$ .
    
    Otherwise, we only have
    $$f_{\Theta}(\tilde{\mathbf{S}} \mathbf{v}^{(1)}, \tilde{\mathbf{S}} \Delta \mathbf{p}, \mathbf{v}^{(2)}) = \tilde{\mathbf{S}}f_{\Theta}(\mathbf{v}^{(1)}, \Delta \mathbf{p}, \mathbf{v}^{(2)}),\quad  \tilde{\mathbf{S}} \in \tilde{K} \leq \tilde{H} \leq \tilde{G} \cong \text{SO}(3),\quad \tilde{K} \cong SO(1) \cong C_2,$$ where $\tilde{K}$ are those elements in $\tilde{H}$ that fix the $\tilde{\mathbf{w}}_1$ axis (i.e. the reflection across the $\tilde{\mathbf{v}}-\tilde{\mathbf{w}}_1$ plane). Note that $\tilde{K}$ is a finite group that is isomorphic to the cyclic group of order 2, $C_2$. This might be limiting, since $\tilde{H}$ is a group of infinite order (we are encoding 'infinitely many' invariances), whereas $\tilde{K}$ is a group of finite order (we are only encoding 'finitely many' invariances).


## Two-drone Autonomous Flight, Outdoors
We fly two drones autonomously outdoor and test both random walk and hover trajectories. 
Apologies for the poor image quality (my bad):
![](https://i.imgur.com/RcZ1h20.jpg)

## Two-drone Flight with Force Compenation, Indoors

We compute estimated force onboard the sufferer drone (by evaluating the equivariant neural network trained with spectral normalization $\gamma = 2$), but do not apply it to the control inputs.
![](https://i.imgur.com/v8OBXDJ.png)