You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The purpose is to finalize the implementation of the Python classes responsible for tracking the state of the boat. This encompasses kinematic information regarding the boat's position, velocity, and acceleration in both global and relative reference frames. For more detailed information on the reference frames utilized, please refer to this confluence page.
Description
You will accomplish the following tasks within boat_simulator/nodes/physics_engine/model.py.
Modify the BoatState constructor to accept the following arguments:
timestep: A scalar value representing the time interval used for calculations, expressed in seconds ($s$).
mass: The total mass of the boat, expressed in kilograms ($kg$).
inertia: The boat's inertia, expressed in kilograms-meters squared ($kg\cdot m^2$).
air_density: A scalar representing the density of air, expressed in kilograms per cubic meter $\left(\dfrac{kg}{m^3}\right)$.
water_density: A scalar representing the density of water, expressed in kilograms per cubic meter $\left(\dfrac{kg}{m^3}\right)$.
sail_lift_coeffs: A lookup table mapping angles of attack ($\alpha$) in degrees to their corresponding lift coefficients.
sail_drag_coeffs: A lookup table mapping angles of attack ($\alpha$) in degrees to their corresponding drag coefficients.
sail_areas: A lookup table mapping angles of attack ($\alpha$) in degrees to their corresponding areas, expressed in square meters ($m^2$).
rudder_drag_coeffs: A lookup table mapping angles of attack ($\alpha$) in degrees to their corresponding drag coefficients.
rudder_areas: A lookup table mapping angles of attack ($\alpha$) in degrees to their corresponding areas, expressed in square meters ($m^2$).
sail_dist: A scalar measuring the distance from the centre of effort of the sail to the pivot point, expressed in meters ($m$).
rudder_dist: A scalar measuring the distance from the centre of effort of the rudder to the pivot point, expressed in meters ($m$).
Add two instances of MediumForceComputation as attributes. One will compute forces on the sail, utilizing the provided air density, and the second will compute forces on the rudder, utilizing the provided water density.
Implement the compute_net_force_and_torque function.
Before beginning this task, ensure familiarity with the reference frames detailed in this confluence page.
This function accepts two arguments, rel_wind_vel and rel_water_vel, representing the velocity of the true wind and the current in the relative reference frame. It returns two arrays: one representing a vector of the total force acting on the boat in the relative reference frame, and the second representing the total torque acting on the boat.
To compute the net force acting on the boat, sum the force exerted on the sail due to wind with the force on the rudder due to water. Utilize the compute function from the respective MediumForceComputation attribute. The compute function takes two arguments: apparent_velocity and orientation. Calculate the apparent_velocity as follows: $$\text{Apparent velocity = Fluid velocity - Medium velocity}$$ Where $\text{Fluid velocity}$ is the velocity of the fluid (true wind or current) in the relative reference frame, and $\text{Medium velocity}$ is the velocity of the boat in the relative reference frame. The orientation parameter denotes the orientation of the medium (sail or rudder), expressed in degrees, in the relative reference frame. Refer to the compute function specification for further details.
Compute the net torque on the boat by summing the torques resulting from the forces on the sail and rudder. The torque on a medium can be computed as follows: $$\text{Torque = Force} \cdot \text{Distance between centre of effort and pivot point} \cdot sin(\text{angle of attack})$$
Tests
Add your unit tests to tests/unit/nodes/physics_engine/test_model.py. Utilize the pytest API for testing, which is already installed.
Upon completion, submit a pull request to the main branch.
Purpose
The purpose is to finalize the implementation of the Python classes responsible for tracking the state of the boat. This encompasses kinematic information regarding the boat's position, velocity, and acceleration in both global and relative reference frames. For more detailed information on the reference frames utilized, please refer to this confluence page.
Description
You will accomplish the following tasks within
boat_simulator/nodes/physics_engine/model.py
.Modify the
BoatState
constructor to accept the following arguments:timestep
: A scalar value representing the time interval used for calculations, expressed in seconds (mass
: The total mass of the boat, expressed in kilograms (inertia
: The boat's inertia, expressed in kilograms-meters squared (air_density
: A scalar representing the density of air, expressed in kilograms per cubic meterwater_density
: A scalar representing the density of water, expressed in kilograms per cubic metersail_lift_coeffs
: A lookup table mapping angles of attack (sail_drag_coeffs
: A lookup table mapping angles of attack (sail_areas
: A lookup table mapping angles of attack (rudder_drag_coeffs
: A lookup table mapping angles of attack (rudder_areas
: A lookup table mapping angles of attack (sail_dist
: A scalar measuring the distance from the centre of effort of the sail to the pivot point, expressed in meters (rudder_dist
: A scalar measuring the distance from the centre of effort of the rudder to the pivot point, expressed in meters (Add two instances of
MediumForceComputation
as attributes. One will compute forces on the sail, utilizing the provided air density, and the second will compute forces on the rudder, utilizing the provided water density.Implement the
compute_net_force_and_torque
function.Before beginning this task, ensure familiarity with the reference frames detailed in this confluence page.
This function accepts two arguments,
rel_wind_vel
andrel_water_vel
, representing the velocity of the true wind and the current in the relative reference frame. It returns two arrays: one representing a vector of the total force acting on the boat in the relative reference frame, and the second representing the total torque acting on the boat.To compute the net force acting on the boat, sum the force exerted on the sail due to wind with the force on the rudder due to water. Utilize the$$\text{Apparent velocity = Fluid velocity - Medium velocity}$$ Where $\text{Fluid velocity}$ is the velocity of the fluid (true wind or current) in the relative reference frame, and $\text{Medium velocity}$ is the velocity of the boat in the relative reference frame. The
compute
function from the respectiveMediumForceComputation
attribute. Thecompute
function takes two arguments:apparent_velocity
andorientation
. Calculate theapparent_velocity
as follows:orientation
parameter denotes the orientation of the medium (sail or rudder), expressed in degrees, in the relative reference frame. Refer to thecompute
function specification for further details.Compute the net torque on the boat by summing the torques resulting from the forces on the sail and rudder. The torque on a medium can be computed as follows:$$\text{Torque = Force} \cdot \text{Distance between centre of effort and pivot point} \cdot sin(\text{angle of attack})$$
Tests
Add your unit tests to
tests/unit/nodes/physics_engine/test_model.py
. Utilize the pytest API for testing, which is already installed.Upon completion, submit a pull request to the main branch.
Resources
The text was updated successfully, but these errors were encountered: