-
Notifications
You must be signed in to change notification settings - Fork 11
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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.
src/helicopter.jl
Outdated
#### Quaternion Functions: ############################################# | ||
######################################################################## | ||
######################################################################## | ||
function hat(v) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
src/helicopter.jl
Outdated
return [0 -v[3] v[2]; v[3] 0 -v[1]; -v[2] v[1] 0] | ||
end | ||
|
||
function L(q) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto above: use the one in Rotations.jl:
https://github.com/JuliaGeometry/Rotations.jl/blob/master/src/unitquaternion.jl#L378
There was a problem hiding this comment.
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....
-
Can you check RobotZoo.jl line 24?
-
Is the updated "helicopter.jl" file visible to you? I have made changes in the new commit...
-
I tried refering to Yakplane.jl, quadrotor.jl and satellite.jl for the organizing the code....Please let me know if you have suggestions...
src/helicopter.jl
Outdated
return L | ||
end | ||
|
||
function qtoQ(q) |
There was a problem hiding this comment.
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.
src/helicopter.jl
Outdated
u[4] = Tail Rotor Thrust | ||
=# | ||
#################################################################### | ||
r = x[1:3] #x y z |
There was a problem hiding this comment.
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]]
src/helicopter.jl
Outdated
#ṙ, 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); |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
If you can see the new helicopter,jl file, here is a reference to point towards my first effort at the relevant changes:
Happy to make more changes and add checks... |
Sorry for not making it object oriented...Happy to make changes, though. Thanks!