Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compute Net Force and Torque on Boat #250

Open
eomielan opened this issue Feb 25, 2024 · 0 comments
Open

Compute Net Force and Torque on Boat #250

eomielan opened this issue Feb 25, 2024 · 0 comments
Labels
enhancement New feature or request sim Boat Simulator team

Comments

@eomielan
Copy link
Member

eomielan commented Feb 25, 2024

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:

    1. timestep: A scalar value representing the time interval used for calculations, expressed in seconds ($s$).
    2. mass: The total mass of the boat, expressed in kilograms ($kg$).
    3. inertia: The boat's inertia, expressed in kilograms-meters squared ($kg\cdot m^2$).
    4. air_density: A scalar representing the density of air, expressed in kilograms per cubic meter $\left(\dfrac{kg}{m^3}\right)$.
    5. water_density: A scalar representing the density of water, expressed in kilograms per cubic meter $\left(\dfrac{kg}{m^3}\right)$.
    6. sail_lift_coeffs: A lookup table mapping angles of attack ($\alpha$) in degrees to their corresponding lift coefficients.
    7. sail_drag_coeffs: A lookup table mapping angles of attack ($\alpha$) in degrees to their corresponding drag coefficients.
    8. sail_areas: A lookup table mapping angles of attack ($\alpha$) in degrees to their corresponding areas, expressed in square meters ($m^2$).
    9. rudder_drag_coeffs: A lookup table mapping angles of attack ($\alpha$) in degrees to their corresponding drag coefficients.
    10. rudder_areas: A lookup table mapping angles of attack ($\alpha$) in degrees to their corresponding areas, expressed in square meters ($m^2$).
    11. sail_dist: A scalar measuring the distance from the centre of effort of the sail to the pivot point, expressed in meters ($m$).
    12. 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.

Resources

@eomielan eomielan added the enhancement New feature or request label Feb 25, 2024
@patrick-5546 patrick-5546 transferred this issue from UBCSailbot/boat_simulator Mar 9, 2024
@patrick-5546 patrick-5546 added the sim Boat Simulator team label Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request sim Boat Simulator team
Projects
Status: Backlog
Development

No branches or pull requests

2 participants