


```javascript
%%javascript
MathJax.Hub.Config({
    TeX: { equationNumbers: { autoNumber: "AMS" } }
});
```


    <IPython.core.display.Javascript object>


## Setup

To start, some simplifications:

1. The robot is currently a point. Not a spherical cow, sadly. 🐮
2. The ropes all meet at the robot point.
3. The ropes are all taut, and aren't elastic.
4. The pulleys are also points.

Let:

- The dimensions of the box made by the pulleys, and their supporting rods, be $B\times D \times H$. 
- The four pulleys be $P_i | i \in {1, 2, 3, 4}$.
  - So the positions of the four pulleys are: 
    $P_1 = (0, 0, H)$, 
    $P_2 = (0, D, H)$, 
    $P_3 = (B, D, H)$, and 
    $P_4 = (B, 0, H)$.
- The length of the the rope from pulley $P_i$ be $l_i$.
- The position of the robot be $(x, y, z)$.

## Relating the locations and lengths

The length of each rope $l_i$ is the distance from the corresponding pulley $P_i$ to the robot:
\begin{align}
\begin{aligned}
l_1^2 &= (0 - x)^2 + (0 - y)^2 + (H - z)^2 \\ &= x^2 + y^2 + (H - z)^2
\end{aligned} \\
\begin{aligned}
l_2^2 &= (0 - x)^2 + (D - y)^2 + (H - z)^2 \\ &= x^2 + (D - y)^2 + (H - z)^2
\end{aligned} \\
\begin{aligned}
l_3^2 &= (B - x)^2 + (D - y)^2 + (H - z)^2 \\ &= (B - x)^2 + (D - y)^2 + (H - z)^2
\end{aligned} \\
\begin{aligned}
l_4^2 &= (B - x)^2 + (0 - y)^2 + (H - z)^2 \\ &= (B - x)^2 + y^2 + (H - z)^2
\end{aligned} \\
\end{align}

We can then get equations featuring only $x$ or only $y$, by subtracting $l_2$ from $l_1$ and $l_3$ from $l_2$:

\begin{align}
\begin{aligned}
l_1^2 - l_2^2 &= y^2 - (D - y)^2 \\
 &= y^2 - (D^2 - 2Dy + y^2) \\
 &= -D^2 + 2Dy 
\end{aligned} \\
\begin{aligned}
l_2^2 - l_3^2 &= x^2 - (B - x)^2 \\
 &= x^2 - (B^2 - 2By + x^2) \\
 &= -B^2 + 2Bx
\end{aligned} \\
\end{align}

So:

\begin{align}
y &= \frac{l_1^2 - l_2^2 + D^2}{2D} \\
x &= \frac{l_2^2 - l_3^2 + B^2}{2B}
\end{align}

Or by other combinations as well:

\begin{align}
l_4^2 - l_3^2 &= y^2 - (D - y)^2 \\
l_1^2 - l_4^2 &= x^2 - (B - x)^2
\end{align}

Giving us a constraint on why we don't have full 6DOF:

\begin{align}
l_1^2 - l_2^2 &= l_4^2 - l_3^2 \\
\end{align}

We can substitute back $x$ and $y$ to get $z$ as a function of $(l_i, B, D, H, x, y)$.

For example, if we substitute $x$ & $y$ in $l_1$ equation, then we get (since this a sq equation, hence 2 solutions)

$z = 0.5(\sqrt(-l_1^4D^2 + 2l_1^2l_2^2D^2 - 2l_1^2D^4 + 4l_1^2 - l_2^4B^2 - l_2^4D^2 - 2l_2^2B^4 + 2l_2^2B^2l_3^2 + 2l_2^2D^4 - B^6 + 2B^4l_3^2 - B^2l_3^4 - D^6) + 2 H)$



## Adding more realism

Now, we can add some complications. First, the pulley is now a pulley and not a dot. We can then say that each length $l_i$ is an inital length $L_i$ plus the length added by unwinding the pulley via rotation, $r_i\Delta\theta_i$. (We're still simplifying by assuming the radius remains constant - in reality, it will change as the rope gets wound or unwound.)

### Tautness
As long as the rope is taut, the lengths will be equal to the distances from equations 1 to 4:

\begin{align}
l_i = L_i + r_i\Delta\theta_i
\end{align}

Other simplifications:

- Identical pulleys.
- The initial position of the robot is set so that the ropes are all equal length (so, at the intersection of the diagonals of the rectangle formed by the pulleys).

Then $L_i$ are all $\frac{1}{2}\sqrt{B^2 + D^2}$.

Using $\Theta$ to denote the tuple of rotations $(\theta_1, \theta_2, \theta_3, \theta_4)$:

$$ 
(x, y, z)  = f(\Theta, B, D, H)
$$

# Two models

The ultimate goal is to get a sequences of rotations of the pulleys that get us from point A $(x_1, y_1, z_1) = f(\Theta_1, B, D, H)$ to point B $(x_2, y_2, z_2) = f(\Theta_2, B, D, H)$.

This can be thought of as a two step process:

1. Get total rotation needed $\Theta_2 - \Theta_1 = \Delta\Theta = (\Delta\theta_1, \Delta\theta_2, \Delta\theta_3, \Delta\theta_4)$.
2. Break that down in to a sequence of small rotations $\{(d\theta_1, d\theta_2, d\theta_3, d\theta_4)_1, (d\theta_1, d\theta_2, d\theta_3, d\theta_4)_2, \ldots\}$, satisfying various constraints:
 - the path is smooth,
 - the ropes don't get too much slack,
 - the robot doesn't get too tilted.
 
Each can be independently modeled.

## Model 1: total movement
For the first model, we can start using the initial assumptions we made, since we can generate training data from the shown equations. This will let us quickly get a reasonable model.

We can then expand it to account for the simplifications we made:

- the robot can be expanded to a platform, with $x, y, z$ as the centre, and distance equations 1-4 are modified to account for the dimensions of the platform,
- the pulleys can be different,
- the pulley radii of vary with rotation,
- the rope has some elasticity, etc.


## Model 2: sequence of steps

For the second model, further consideration is needed. Possibilities:

- Since we are using stepper motors, we can consider $\Delta\theta_i$ to be $N_{steps, i} \times d\theta_{step, i}$, with $d\theta_{step, i}$ being constant for each pulley/motor. 
- Then, instead of $\Delta\Theta$, we can work with the total number of steps needed for each motor: $(N_1, N_2, N_3, N_4)$.
- And we can break down the total number of steps a sequence of smaller steps where each motor moves one step, or not at all: $(1, 0, 1, 0), (0, 0, 1, 0), \ldots$.
- At each step, we ensure that the rope is taut (equation 12), and if any rope gets too much slack, prioritize rotating that pulley to accomodate make the rope taut.


```python

```

5a710fe69f16f665ba180c81824ec03f468fd576
ipynb
Jupyter Notebook
Suspended_Robot/Equations.ipynb
Machine-Learning-Tokyo/Agritech
855569561140bb06a13cce81495673bea471cbd0
Apache-2.0
2019-07-29T23:16:44.000Z
2022-03-02T14:08:47.000Z
Suspended_Robot/Equations.ipynb
Machine-Learning-Tokyo/Agritech
855569561140bb06a13cce81495673bea471cbd0
Apache-2.0
2019-08-21T02:59:05.000Z
2019-08-25T09:28:40.000Z
Suspended_Robot/Equations.ipynb
Machine-Learning-Tokyo/Agritech
855569561140bb06a13cce81495673bea471cbd0
Apache-2.0
2021-01-11T01:06:22.000Z
2021-01-11T01:06:22.000Z
Qwen/Qwen-72B
1. YES
2. YES