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

Helicopter Model added: (need to uncomment visualizer) #7

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

SharvitDabir
Copy link

Sorry for not making it object oriented...Happy to make changes, though. Thanks!

Copy link
Member

@bjack205 bjack205 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple things that need to be done:

  • Make it object oriented and use the RobotDynamics interface. See any of the other models in this repo for examples on how to do this.
  • Include this file in src/RobotZoo.jl
  • Add some tests to make sure it works as you expect.

I'm happy to answer any questions you have about how to do these.

#### Quaternion Functions: #############################################
########################################################################
########################################################################
function hat(v)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use the one defined in Rotations.jl instead of defining your own:
https://github.com/JuliaGeometry/Rotations.jl/blob/master/src/util.jl#L34

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I will be on it.

return [0 -v[3] v[2]; v[3] 0 -v[1]; -v[2] v[1] 0]
end

function L(q)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

@SharvitDabir SharvitDabir Apr 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes have been made....

  1. Can you check RobotZoo.jl line 24?

  2. Is the updated "helicopter.jl" file visible to you? I have made changes in the new commit...

  3. I tried refering to Yakplane.jl, quadrotor.jl and satellite.jl for the organizing the code....Please let me know if you have suggestions...

return L
end

function qtoQ(q)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto. Prefer to use Rotations.jl to do these types of conversions.

u[4] = Tail Rotor Thrust
=#
####################################################################
r = x[1:3] #x y z
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd highly recommend making these static arrays, e.g.:

r = SA[x[1], x[2], x[3]]

#ṙ, q̇, v̇, ω̇
r_dot = Q * v
q_dot = 0.5 * L(q) * H * ω
v_dot = [(v[2] * ω[3]) - (v[3] * ω[2]) - g_matrix[1] + ((Xmr + Xfus) / M);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, you can save an allocation by trivially making this a static array by placing an SA in front:

SA[
# my terms...
]

####################################################################
"""
# Animation
function set_heli_model!(vis::Visualizer)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should just comment this out for now. We're working on another package (WIP) to hold visualizations for the models.

M = 8.2 #kg

## INERTIA
Ixx = 0.18 #kg m^2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These type of model parameters can go in the model struct

@SharvitDabir
Copy link
Author

If you can see the new helicopter,jl file, here is a reference to point towards my first effort at the relevant changes:

  1. Quaternion functions --> Lines 1,2 & Lines 135,166
  2. StaticArrays -> Lines 127-132 & Lines 167, 170, 177
  3. Struct for heli-parameters --> Lines 4-29 & Lines 32-83
  4. Line 177 returns the derivatives....?
  5. trim_controls --> values found in jupyter-notebook have been hardcoded here.

Happy to make more changes and add checks...

@SharvitDabir SharvitDabir requested a review from bjack205 April 15, 2022 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants