Animation User-Friendliness Improvements#36
Animation User-Friendliness Improvements#36crystalsolenoid wants to merge 3 commits intoOSU-LRAM:Hossein's-Branchfrom
Conversation
- 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; |
There was a problem hiding this comment.
What purpose does the number 2 have here in the variable names?
| 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 |
There was a problem hiding this comment.
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)
| 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']; |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Can we make this an input variable? (part of info_needed?)
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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? |
There was a problem hiding this comment.
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}; |
There was a problem hiding this comment.
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); |
| 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!! |
There was a problem hiding this comment.
For demo systems, let's clean out any unnecessary comments.
TODO: