-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
109 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
function xdot_state_est = ConvertXdotModelToStateEstimatorFrame(x_model_frame, xdot_model_frame) | ||
|
||
% in this case, the only difference between the two frames is the 180 | ||
% degree rotation about the x axis | ||
|
||
|
||
% TODO: CHECKME | ||
rotm(1:3,1:3) = [ 1, 0, 0; | ||
0, -1, 0; | ||
0, 0, -1]; | ||
|
||
rotm_full = blkdiag(rotm, rotm, rotm, rotm); | ||
|
||
xdot_state_est = rotm_full * xdot_model_frame; | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
classdef DeltawingPlantStateEstFrame < DrakeSystem | ||
% Defines the dynamics for the TBS Capi delta wing in the state estimator | ||
% frame. Use this for TVLQR but NOT FOR ANYTHING ELSE! | ||
|
||
properties | ||
p = {}; % DeltawingPlant | ||
end | ||
|
||
methods | ||
function obj = DeltawingPlantStateEstFrame(p) | ||
% @param parmaeters cell array of extra arguments to pass to | ||
% tbsc_model | ||
|
||
obj = obj@DrakeSystem(12,0,3,12,false,true); | ||
obj = setDirectFeedthrough(obj,0); | ||
obj = setOutputFrame(obj,getStateFrame(obj)); | ||
|
||
obj = obj.setInputLimits(p.umin, p.umax); % input limits in [radians radians newtons] | ||
|
||
obj.p = p; | ||
|
||
end | ||
|
||
function [xdot, dxdot] = dynamics(obj, t, x, u) | ||
options = struct(); | ||
options.grad_method = 'numerical'; | ||
|
||
tempfunc = @(t, x, u) obj.dynamics_no_grad(t, x, u); | ||
|
||
[xdot, dxdot] = geval(tempfunc, t, x, u, options); | ||
end | ||
|
||
function xdot = dynamics_no_grad(obj,t,x,u) | ||
|
||
x_drake_frame = ConvertStateEstimatorToDrakeFrame(x); | ||
|
||
xdot_drake_frame = obj.p.dynamics(t, x_drake_frame, u); | ||
|
||
xdot = ConvertXdotDrakeToStateEstimatorFrame(x_drake_frame, xdot_drake_frame); | ||
|
||
|
||
end | ||
|
||
function [y,dy] = output(obj,t,x,u) | ||
y = x; | ||
if (nargout>1) | ||
dy=[zeros(obj.num_y,1),eye(obj.num_y),zeros(obj.num_y,obj.num_u)]; | ||
end | ||
end | ||
|
||
function x = getInitialState(obj) | ||
x = zeros(12,1); | ||
end | ||
|
||
end | ||
|
||
methods (Static) | ||
|
||
function playback(xtraj, utraj, options) | ||
error('be super careful, you are attempting playback with a state-estimator-frame plant. Probably you have plants mixed up.'); | ||
|
||
end | ||
|
||
function playback_xtraj(xtraj, options) | ||
error('be super careful, you are attempting playback with a state-estimator-frame plant. Probably you have plants mixed up.'); | ||
|
||
end | ||
|
||
|
||
function v = constructVisualizer() | ||
error('be super careful, you are attempting playback with a state-estimator-frame plant. Probably you have plants mixed up.'); | ||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters