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

Other side MTKv9 #61

Merged
merged 8 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
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
436 changes: 262 additions & 174 deletions Manifest.toml

Large diffs are not rendered by default.

18 changes: 15 additions & 3 deletions docs/src/examples/robot.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ using Test

t = Multibody.t
D = Differential(t)
@named robot = Multibody.Robot6DOF(trivial=true)
@named robot = Multibody.Robot6DOF(trivial=false)
robot = complete(robot)

length(equations(robot))
Expand All @@ -37,7 +37,7 @@ prob = ODEProblem(ssys, Dict([
robot.axis1.motor.Jmotor.phi => deg2rad(-60) * -105 # Multiply by gear ratio
robot.axis2.motor.Jmotor.phi => deg2rad(20) * 210
robot.axis3.motor.Jmotor.phi => deg2rad(90) * 60
]), (0.0, 4.0))
]), (0.0, 2.0))
sol = solve(prob, Rodas5P(autodiff=false));
@test SciMLBase.successful_retcode(sol)

Expand Down Expand Up @@ -68,7 +68,19 @@ plot!(sol, idxs = [
], sp=7:12, lab="Position error", link=:x)
plot!(xlabel=[fill("", 1, 9) fill("Time [s]", 1, 3)])
```
We see that after an initial transient, the robot controller converges to tracking the reference trajectory well.
We see that after an initial transient, the robot controller converges to tracking the reference trajectory well. However, since the first three axes of the robot are modeled as slightly flexible, and we are ultimately interested in the tracking performance _after_ the gear box and any flexibilities it may suffer from, we plot also this tracking error
```@example robot
plot(sol, idxs = [
robot.axis1.controller.feedback1.output.u / ( -105)
robot.axis2.controller.feedback1.output.u / (210)
robot.axis3.controller.feedback1.output.u / (60)
], layout=(1,3), lab="Position error, motor side", link=:x)
plot!(sol, idxs = [
robot.pathPlanning.controlBus.axisControlBus1.angle_ref - robot.mechanics.r1.phi #
robot.pathPlanning.controlBus.axisControlBus2.angle_ref - robot.mechanics.r2.phi #
robot.pathPlanning.controlBus.axisControlBus3.angle_ref - robot.mechanics.r3.phi #
], lab="Position error, arm side")
```



Expand Down
Loading
Loading