Fawkes API
Fawkes Development Version
|
Katana motor control thread. More...
#include "goto_thread.h"
Public Member Functions | |
KatanaMotorControlThread (fawkes::RefPtr< fawkes::KatanaController > katana, fawkes::Logger *logger, unsigned int poll_interval_ms) | |
Constructor. | |
virtual void | set_encoder (unsigned int nr, int value, bool inc=false) |
Set target encoder value. | |
virtual void | set_angle (unsigned int nr, float value, bool inc=false) |
Set target angle value. | |
virtual void | once () |
Execute an action exactly once. | |
Protected Member Functions | |
virtual void | run () |
Stub to see name in backtrace for easier debugging. |
Katana motor control thread.
This thread moves a single motor to/by a given value in encoders or angle.
KatanaMotorControlThread::KatanaMotorControlThread | ( | fawkes::RefPtr< fawkes::KatanaController > | katana, |
fawkes::Logger * | logger, | ||
unsigned int | poll_interval_ms | ||
) |
Constructor.
katana | katana controller base class |
logger | logger |
poll_interval_ms | interval in ms between two checks if the final position has been reached |
Definition at line 41 of file motor_control_thread.cpp.
void KatanaMotorControlThread::once | ( | ) | [virtual] |
Execute an action exactly once.
This code is executed once and only once right after the thread is started before loop() is called. This is useful if you want to implement an one-shot background job. Just implement once() and leave once() untouched. Start the thread and detach it and it will just do its job and then die automatically. If you use set_delete_on_exit(true) even the Thread instance will be automatically deleted.
Reimplemented from fawkes::Thread.
Definition at line 82 of file motor_control_thread.cpp.
References KatanaMotionThread::_katana, KatanaMotionThread::_logger, fawkes::Logger::log_warn(), fawkes::Exception::what(), KatanaMotionThread::_finished, KatanaMotionThread::_error_code, fawkes::Logger::log_debug(), and fawkes::Thread::name().
virtual void KatanaMotorControlThread::run | ( | ) | [inline, protected, virtual] |
Stub to see name in backtrace for easier debugging.
Reimplemented from fawkes::Thread.
Definition at line 41 of file motor_control_thread.h.
void KatanaMotorControlThread::set_angle | ( | unsigned int | nr, |
float | value, | ||
bool | inc = false |
||
) | [virtual] |
Set target angle value.
nr | number of motor |
value | angle value |
inc | is value incremental? deault:false -> absolute |
Definition at line 71 of file motor_control_thread.cpp.
void KatanaMotorControlThread::set_encoder | ( | unsigned int | nr, |
int | value, | ||
bool | inc = false |
||
) | [virtual] |
Set target encoder value.
nr | number of motor |
value | encoder value |
inc | is value incremental? deault:false -> absolute |
Definition at line 56 of file motor_control_thread.cpp.