blob: 5e00771b616d82e481ab5d37c7d9ef405a2037b3 [file] [log] [blame]
Austin Schuh7400da02018-01-28 19:54:58 -08001/*!
2@page getting_started Getting Started
3
4In order to get you started with using the Control Toolbox, there are several useful resources available. First make sure
5you have installed the Control Toolbox as described in the \ref install_guide "Installation Guide". Afterwards you can
6follow the Tutorials below.
7
8- \subpage tut_basics "Basics Tutorial"
9- \subpage core_tutorials "ct core Tutorials"
10- \subpage optcon_tutorials "ct optcon Tutorials"
11- \subpage rbd_tutorials "ct rbd Tutorials"
12
13If you need additional support, feel free to create an issue on Bitbucket or contact the developers.
14
15\page tut_basics Basic Tutorial
16@tableofcontents
17
18\section tut_basics_pkg Creating a ROS package
19CT is middleware free. Therefore, you are not bound to use ROS or catkin. However, for the sake of simplicity we will use catkin in this tutorial.
20Make sure you have succesfully downloaded and compiled CT according to our @ref gs instructions. Afterwards go to your catkin workspace
21and create a new package
22
23\code{.sh}
24cd ~/catkin_ws/src
25catkin_create_pkg my_ct_project roscpp ct_core ct_rbd ct_optcon ct_models
26\endcode
27
28In this example, we made \a my_ct_project dependent on all CT packages. This is not strictly necessary, however there is no harm to it either.
29
30
31\section tut_basics_exec Creating our first executable
32
33First, we are going to simulate the dynamics of a damped oscillator. Let's create our main file
34
35\include DampedOscillator.cpp
36
37So what happens in this code? We first include ct/core.h. This includes all relevant headers from CT Core. Other CT modules have similar header files
38such as \a ct/rbd.h . If you were to include ct/rbd.h you would not have to include ct/core.h anymore. It is automatically included.
39
40Then, we create a state vector and set it to zero. Afterwards, we can create a shared pointer to a ct::core::SecondOrderSystem
41which is a damped oscillator. It is derived from type ct::core::System, which means we can directly plug it into a ct::core::Integrator. Here, we have many
42choices such as ct::core::IntegratorEuler or ct::core::ODE45. Here, we chose a fourth-order Runge-Kutta integrator. We then simulate (integrate) it forward
43for 1 second with a time step of 0.001 seconds. Finally, we print the new state.
44
45
46\section tut_basics_system Creating our first system
47In the example above, we have been using an oscillator that is provided with CT. However, we might want to model our own system. Here, we will model
48a simple mass point subject to friction. However, if you are interested in more sophisticated models, especially Rigid Body Dynamics, make sure you
49check out the tutorials in ct_rbd as well.
50
51First we create our system within a header Masspoint.h
52
53\include Masspoint.h
54
55As before, we can now integrate this system forward
56
57\include MasspointIntegration.cpp
58
59
60 */