Skip to content

Conversation

@crystalsolenoid
Copy link
Contributor

  • Instead of exporting images of frames to be compiled into a video later, animation.m now uses the '-RGBImage' option of print() to collect frames in a datastructure and export a .avi movie within the script.
  • Instead of making new animation functions for each new system, it is now possible to add a field s.BackboneShape to the system. This is a cell array of functions that describe the geometry. s.BackboneShape will be passed through to the animation functions, and only the sysf file itself needs to be created.
  • Added a system flyingsnakebot_smallrange to GenericUser as an example of using s.BackboneShape
  • Some changes need to be made to the other animate_[systemname] functions to be compatible with the new animation.m. I've changed animate_3_link_swimmer.m to work, so that can be used as a template for the others.

TODO:

  • Rename s.BackboneShape to s.Geometry
  • Add functionality for different kinds of geometry like absolute functions or n-link swimmers

- Instead of exporting images of frames to be compiled into a video later, animation.m now uses the '-RGBImage' option of print() to collect frames in a datastructure and export a .avi movie within the script.
- Instead of making new animation functions for each new system, it is now possible to add a field s.BackboneShape to the system. This is a cell array of functions that describe the geometry. s.BackboneShape will be passed through to the animation functions, and only the sysf file itself needs to be created.
- Added a system flyingsnakebot_smallrange to GenericUser as an example of using s.BackboneShape
- Some changes need to be made to the other animate_[systemname] functions to be compatible with the new animation.m. I've changed animate_3_link_swimmer.m to work, so that can be used as a template for the others.

TODO:
- Rename s.BackboneShape to s.Geometry
- Add functionality for different kinds of geometry like absolute functions or n-link swimmers
destination = cellfun(@(x) fullfile(destination_root,x),destination_list,'UniformOutput',false);

% Pass the system and gait names to the frame_info struct
frame_info{1}.sysname = info_needed.current_system2;
Copy link
Contributor

Choose a reason for hiding this comment

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

What purpose does the number 2 have here in the variable names?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

for i = 1:numel(ishape)
frame_info{ishape(i)}.printmethod = @(dest) printeps_gillsans(frame_info{ishape(i)}.f,dest);
frame_info{ishape(i)}.printmethod = @(dest) print(frame_info{ishape(i)}.f,dest);
% can't find printeps_gillsans anywhere so I won't use it
Copy link
Contributor

Choose a reason for hiding this comment

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

That was me getting into fonts 9 years ago, and writing some postprocessing functions to match my presentations. No longer needed, print is fine.

(the functions also did some stuff to get around some matlab layering output bugs that have since been made obsolete by a better rendering engine a few years ago)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

function animate_backbone(export,info_needed)

% Look up the backbone specification for this snake:
sysfile = [info_needed.UserFile_path '\sysf_' info_needed.current_system2 '.mat'];
Copy link
Contributor

Choose a reason for hiding this comment

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

use fullfile (see suggestions in the other review) for cross-platform operation

= @execute_gait; % frame function, defined below in file

% Declare timing
timing.duration = 8; % in seconds
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make this an input variable? (part of info_needed?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

future development

% Declare timing
timing.duration = 8; % in seconds
timing.fps = info_needed.Framerate; % create frames for 15 fps animation
timing.pacing = @(y) linspace(0,1,y); % Use a soft start and end, using the included softstart function
Copy link
Contributor

Choose a reason for hiding this comment

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

this should use softspace instead of linspace, by default. Maybe put in an option to have it use linspace.

load(sysfile,'s')

% Check whether it is 3-links, 4-inks, serpenoid ot triangular
if findstr(current_system2,'serpenoid')
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's make a note to come back and clean up this logic

output = 'Flying SnakeBot: 4.7 Curvature Limit'; % Display name

case 'dependency'
%need to change these?
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, change these. Our sysf-builder should probably generate this output dependency list from the chosen geometry functions

case 'initialize'

%Functional representation of backbone shape
s.BackboneShape = {@constant_curvature_1;@constant_curvature_2};
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we make this into s.geometry before releasing the code, so that we don't leave people generating halfway updated system files?

%Range over which to evaluate connection
%The 1.1 is to hide the ugly boundary vectors
%s.grid_range = [-1,1,-1,1]*12;
s.grid_range = [-1,1,-1,1]*(rangeofmotion+0.5);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the +.5?

s.density.scalar = [21 21]; %density to display scalar functions
s.density.eval = [51 51]; %density for function evaluations %%%%%%%%can change this for gaits 51?
s.finite_element_density = 11;
% change this from LowRE to Inertial!!
Copy link
Contributor

Choose a reason for hiding this comment

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

For demo systems, let's clean out any unnecessary comments.

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