-
Notifications
You must be signed in to change notification settings - Fork 501
Chrono Core Components
This page focuses on all of the core components of Project Chrono, all of which are located in src/chrono/core
.
What it is
The ChFrame
represents any object that has a position and a rotation. Many objects derive from the ChFrame
, as most objects will have these properties.
How Do I use it
The ChFrame
is located in the core library:
#include "chrono/core/ChFrame.h"
A ChFrame
can be instantiated using a default constructor. When the default constructor is used, the ChFrame
is located at the origin with no rotation.
chrono::ChFrame the_frame;
Other constructors allow you to set initial positions and directions for the ChFrame
.
You can set a frame with an initial position and direction.
chrono::ChFrame frame_object(chrono::ChVector3d(1,2,3),chrono::ChQuaterniond(1,0,0,0));
You can also use a rotation matrix to define the direction instead of a quaternion.
chrono::ChMatrix33d matrix_object({{1,4,5},{23.7,90,43},{82.1,18,544}});
chrono::ChFrame frame_object(chrono::ChVector3d(3,4,5), matrix_object);
It is also possible to make a frame out of a set of predefined coordinates.
chrono::ChCoordsysd coords(chrono::ChVector3d(1,2,3),chrono::ChQuaterniond(1,0,0,0));
chrono::ChFrame frame_object(coords)
A ChFrame
can be printed directly to an output stream:
std::cout << the_frame << std::endl;
This will display the position in
someone@computer:/location#
0 0 0
1 0 0 0