-
Notifications
You must be signed in to change notification settings - Fork 10
Animation User-Friendliness Improvements #36
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
base: Hossein's-Branch
Are you sure you want to change the base?
Animation User-Friendliness Improvements #36
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.
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?
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.
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 |
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.
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)
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.
| 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.
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 |
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.
Can we make this an input variable? (part of info_needed?)
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.
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.
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') |
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.
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.
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}; |
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.
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); |
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.
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!! |
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.
For demo systems, let's clean out any unnecessary comments.
TODO: