-
Notifications
You must be signed in to change notification settings - Fork 1
New Controller
Some commonalities are required for every controller. Refer to implemented controllers (such as OSC
) if things are unclear.
The ControllerPCC
class provides you with a strong base. It takes care of updating state and model automatically so you do not need to worry about that.
It also contains functions for setting reference positions and actuating which you can use out of the box.
You'll want to base your controller off of ControllerPCC
. To do this include the ControllerPCC.h
in your header.
When creating your class, make it a child of ControllerPCC
:
class MyController: public ControllerPCC {
};
Your control loop run in its own thread. To do this, create a control loop function:
void control_loop
and call it in the constructor:
control_thread_ = std::thread(&YourController::control_loop, this);
Make sure your controller doesn't move before receiving any references by adding following to the control loop:
if (!is_initial_ref_received)
continue;
Refer to existing controllers such as OSC
for more details.
Make sure your loops terminate and threads are joined in the destructor.
First, we'll need to do some management stuff to ensure you can write it correctly.
Put your header file in include/3d-soft-trunk/Controllers/
Put your implementation file in src/Controllers
So that the project will take your new controller into account, you'll have to edit the main CMake file.
It is called CMakeLists.txt
and is in the main directory.
Add a new library for your controller and link dependencies (around line 70):
add_library(YourController SHARED src/Controllers/YourController.cpp)
target_link_libraries(YourController ControllerPCC YourControllerDependency1)