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

added assignment-version of godObject.cpp #361

Open
wants to merge 2 commits into
base: BIS22
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions firmware/src/physics/godObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,25 @@ bool GodObject::move(bool isTweening, bool isForceRendering, bool isFrozen)
}

Vector2D GodObject::getCollisionForce(Vector2D godObjectPosition, Vector2D handlePosition){
// the PID error is the difference between the virtual object and the handle position
// the virtual object can either be a) the godobject or b) the tether
auto error = godObjectPosition - handlePosition;
auto force = error * forcePidFactor[0][0] + (error - m_lastError) * forcePidFactor[0][2];
m_lastError = error;

// TODO:
// Given a position of god-object and the position of the handle,
// calculate rendering force.

// Variables given:
// Vector2D godObjectPosition, handlePosition : position of god-object and handle.
// float K : proportional gain for force used in the god-object rendering.

// Returns:
// Vector2D force, rendering force that you will apply to the device.

const float K = forcePidFactor[0][0];
Vector2D force = Vector2D(0,0);

// YOUR CODE STARTS


// YOUR CODE ENDS
return force;
}

Expand Down