Satellite Physics Toy
I was chatting about satellites with a friend, comparing them with quadcopters. The motion and the pose of a quad are linked (unless you get fancy and start rotating the props or motors, but that’s more like a helicopter). You can’t go forwards without tilting the aircraft forwards etc etc
Drones have to deal with a constant 1G of external acceleration force and wind. Drones use batteries. Without propulsion, a drone falls out of the sky.
It is possible to design a satellite that can move in only one direction without changing any other pose. This seems ‘easier,’ but I don’t know what satellite people prefer (I know they use internal spinning wheels for rotating inertia stuff). Satellites deal with a wide range of external acceleration forces. Satellites use material fuel, so whenever they make a control action, the mass of the craft changes, so the momentum changes. Without propulsion, a satellite will keep moving in the direction it was moving (+ external acceleration forces).
Anyway, I was looking for a physics modeling-type project for p5.js. I spend enough time thinking about drones, so I figured I would try to make a 2D satellite simulator. The satellite is a cube with eight thrusters. The thrusters can be triggered individually or combined to create different types of motion. The thrusters use ‘fuel’, reducing the satellite’s mass and changing how fast it reacts to control inputs.
All SI values were chosen for aesthetic and animation reasons.
I started with the physics of manual control - flying the satellite around by triggering thrusters. It gets out of control very quickly! So I added some more maths to calculate the control efforts needed to bring the satellite velocity to zero. And sometimes, it stopped partially offscreen. So I added even more maths that would control the thrusters to fly the satellite back to the center of the screen.
So the control sequence looks like this:
- stop any spin
- stop the trajectory
- make the satellite orient with the screen
- fly the satellite back to the center of the screen
This approach is not efficient. Control efforts might be spending fuel to kill momentum and then creating a similar moment in the next step of the sequence. There is a lot to think about to get opportunistic fuel efficiency correct. And I was doing this for fun.
Also, the physics gets weird at high speed + high spin. Breaking it is half the fun.