Skip to content

Commit 3d53840

Browse files
committed
feat: forces and moments simulator architecture description
1 parent d87a8e9 commit 3d53840

2 files changed

Lines changed: 54 additions & 3 deletions

File tree

docs/user-guide/concepts/simulator-architecture.md

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,61 @@ Also note that the `sensors` node could have been implemented as a separate node
192192
If you are adding a new sensor (e.g. camera), you could either change the `sensor` source code or create an entirely separate ROS2 node for your sensor.
193193

194194
### Forces and Moments
195-
!!! danger "TODO"
196-
continue here... This page is still under construction. Check back soon!
195+
The `forces_and_moments` node is responsible for computing the **aerodynamic** forces and moments based on a model of the aircraft.
196+
Other forces like gravity and collision forces are not included in the `forces_and_moments` node.
197+
198+
The `forces_and_moments` node takes in raw PWM commands published by the `sil_board` node over the `sim/pwm_output` topic.
199+
These PWM commands correspond to what would be either servo deflections or motor throttle values on the physical aircraft.
200+
To compute the forces and moments generated by those actuator commands, we need to convert the PWM commands into inputs used by our model.
201+
202+
#### Fixedwing
203+
For fixedwing aircraft, our aerodynamic model is the model proposed in *Small Unmanned Aircraft: Theory and Practice* by Beard and McLain.
204+
It takes in 4 commands, \(\delta_a, \delta_e, \delta_r, \in [-1,1]\) and \(\delta_t \in [0,1]\), corresponding to aileron, elevator, rudder servo commands, and throttle setting, respectively.
205+
Thus, we need to convert the relevant PWM commands on the corresponding channels into these four servo and throttle setpoints.
206+
207+
For the "standard" airframe this is trivial, since the standard airframe maps a single PWM command to one of the 4 inputs to our model.
208+
We just need to know what PWM channels correspond to which servo, and then convert the PWM command to within the correct range (i.e. [-1,1] or [0,1]).
209+
210+
For a non-standard airframe (i.e. vtail, like the [RMRC Anaconda](https://www.readymaderc.com/products/details/rmrc-anaconda-kit?srsltid=AfmBOopBO1pTJlXnkzJTptNt_7ki6yl3ING49Oe518JvIjyqUAUdg9OX)), the information sent by the firmware over the `pwm_output` topic does not correspond to the "standard" inputs required by our model.
211+
This means we first have to unmix the actual PWM commands to get the equivalent "standard" commands.
212+
213+
The `forces_and_moments` node accomplishes this by querying the `sil_board` node through `rosflight_io` to determine the current values of the mixer.
214+
It saves the mixer and unmixes the input PWM commands back to the "standard" commands.
215+
We then can use our aerodynamic model to compute the forces and torques.
216+
217+
This process is shown in Fig 2.
218+
219+
| ![Flow of information through the forces and moments node](../images/simulator_architecture_fandm.svg) |
220+
| :--- : |
221+
| Fig 2: Flow of information through the `forces_and_moments` node. The \(\delta_{r1}\) and \(\delta_{r2}\) values in the data of the `/sim/pwm_output` section refer to the right and left ruddervator commands used for a vtail aircraft. Note how the mixer is used in two places. |
197222

198-
The `forces_and_moments` node
223+
!!! note
199224

225+
We could skip all the mixing and unmixing and subscribe directly to the incoming "standard" commands before they go into the `sil_board` node.
226+
This, however, **reduces the realism** of the simulator, since it neglects any changes that could have been made by the firmware to those commands.
227+
228+
!!! warning "Max servo deflection"
229+
230+
Make sure the `max_aileron_deflection_angle`, `max_elevator_deflection_angle`, and `max_rudder_deflection_angle` parameters are set correctly.
231+
This scales the PWM command from [-1, 1] to the actual physical angle used by the aerodynamic model.
232+
233+
**If these are incorrect, the simulated aircraft will behave very differently than the physical one.**
234+
235+
#### Multirotors
236+
237+
The model used for the multirotor is simpler than the fixedwing aerodynamic model.
238+
It consists of a model of the motor and propeller as well as some drag parameters.
239+
240+
Since each PWM command from the firmware maps directly to a single motor, we don't have to unmix the commands to compute the forces and moments.
241+
Instead, we use the position and direction of the rotors to directly compute the forces and moments using the motor/prop equations.
242+
More information on these equations can be found in chapters 4 and 14 of *Small Unmanned Aircraft: Theory and Practice*.
243+
244+
However, we do need to accurately set the positions of the motors.
245+
This is done through the `rotor_dists`, `rotor_radial_angles`, and `rotor_rotation_directions` parameters of the `forces_and_moments` node.
200246

201247
### Dynamics
248+
!!! danger "TODO"
249+
continue here... This page is still under construction. Check back soon!
202250

203251
## Swapping out modules
204252

docs/user-guide/images/simulator_architecture_fandm.svg

Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)