Kinematics Animation Multithread
Functions
main.cpp File Reference
#include <iostream>
#include <vector>
#include <igl/opengl/glfw/Viewer.h>
#include <igl/opengl/glfw/imgui/ImGuiPlugin.h>
#include <igl/opengl/glfw/imgui/ImGuiMenu.h>
#include <igl/opengl/glfw/imgui/ImGuiHelpers.h>
#include <igl/slim.h>
#include "./include/euler_rotations.h"
#include "./include/exoskeleton.h"
#include "./include/menu_handler.h"
#include "./include/animated_hand.h"
#include "./include/kinematic_animation.h"
Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

int main (void)
 This is the main execution function. It first initiates the libigl viewer and then calls the menu handler from ImGui. It then defines the exoskeleton handlers and defines the callback function for the rendering loop. For a better understanding of the dependencies see the provided call graph. More...
 

Function Documentation

◆ main()

int main ( void  )

This is the main execution function. It first initiates the libigl viewer and then calls the menu handler from ImGui. It then defines the exoskeleton handlers and defines the callback function for the rendering loop. For a better understanding of the dependencies see the provided call graph.

Definition at line 22 of file main.cpp.

23{
24 // Initialize viewer
25 igl::opengl::glfw::Viewer viewer;
26
27 // Attach a menu plugin
28 igl::opengl::glfw::imgui::ImGuiPlugin plugin;
29 viewer.plugins.push_back(&plugin);
30 igl::opengl::glfw::imgui::ImGuiMenu menu;
31 plugin.widgets.push_back(&menu);
32
33 // Menu handler
34 MenuHandler menu_handler(&menu);
35
36 // Generate lamda function pointing to the menu callback
37 auto lamda_menu_fun = [&menu_handler]() { return menu_handler.callback(); };
38 menu.callback_draw_viewer_menu = lamda_menu_fun;
39
40 // Initialize left exoskeleton handle
41 Exoskeleton left_exoskeleton;
42
43 // Initialize animated hand handler
44 AnimatedHand anim_hand;
45
46 // Initialize kinematic animation
48 ka.initialize(&viewer, &left_exoskeleton, &anim_hand, &menu_handler);
49
50 // Generate lamda function pointing to the animation loop member function
51 auto lamda_anim_fun =
52 [&ka](igl::opengl::glfw::Viewer& viewer) { return ka.animation_loop(viewer); };
53
54
55 // Set animation
56 viewer.data().show_overlay_depth = false;
57 viewer.data().line_width = 1;
58 viewer.data().show_lines = false;
59 viewer.callback_pre_draw = lamda_anim_fun;
60 viewer.core().is_animating = true;
61 viewer.core().animation_max_fps = 30;
62 viewer.launch();
63}
Class Exoskeleton.
Definition: exoskeleton.h:20
Class KinematicAnimation.
void initialize(igl::opengl::glfw::Viewer *viewer, Exoskeleton *left_exo, AnimatedHand *anim_hand, MenuHandler *menu_handler)
Initialize animation.
bool animation_loop(igl::opengl::glfw::Viewer &viewer)
Animation loop callback.
Class MenuHandler.
Definition: menu_handler.h:23
Here is the call graph for this function: