blob: 5e00771b616d82e481ab5d37c7d9ef405a2037b3 [file] [log] [blame]
/*!
@page getting_started Getting Started
In order to get you started with using the Control Toolbox, there are several useful resources available. First make sure
you have installed the Control Toolbox as described in the \ref install_guide "Installation Guide". Afterwards you can
follow the Tutorials below.
- \subpage tut_basics "Basics Tutorial"
- \subpage core_tutorials "ct core Tutorials"
- \subpage optcon_tutorials "ct optcon Tutorials"
- \subpage rbd_tutorials "ct rbd Tutorials"
If you need additional support, feel free to create an issue on Bitbucket or contact the developers.
\page tut_basics Basic Tutorial
@tableofcontents
\section tut_basics_pkg Creating a ROS package
CT 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.
Make sure you have succesfully downloaded and compiled CT according to our @ref gs instructions. Afterwards go to your catkin workspace
and create a new package
\code{.sh}
cd ~/catkin_ws/src
catkin_create_pkg my_ct_project roscpp ct_core ct_rbd ct_optcon ct_models
\endcode
In 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.
\section tut_basics_exec Creating our first executable
First, we are going to simulate the dynamics of a damped oscillator. Let's create our main file
\include DampedOscillator.cpp
So 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
such 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.
Then, we create a state vector and set it to zero. Afterwards, we can create a shared pointer to a ct::core::SecondOrderSystem
which 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
choices such as ct::core::IntegratorEuler or ct::core::ODE45. Here, we chose a fourth-order Runge-Kutta integrator. We then simulate (integrate) it forward
for 1 second with a time step of 0.001 seconds. Finally, we print the new state.
\section tut_basics_system Creating our first system
In 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
a simple mass point subject to friction. However, if you are interested in more sophisticated models, especially Rigid Body Dynamics, make sure you
check out the tutorials in ct_rbd as well.
First we create our system within a header Masspoint.h
\include Masspoint.h
As before, we can now integrate this system forward
\include MasspointIntegration.cpp
*/