Dezibot 4
Loading...
Searching...
No Matches
Motion Class Reference

#include <Motion.h>

+ Collaboration diagram for Motion:

Public Member Functions

void begin (void)
 Initialize the movement component.
 

Static Public Member Functions

static void move (uint32_t moveForMs=0, uint baseValue=DEFAULT_BASE_VALUE)
 Move forward for a certain amount of time. Call with moveForMs 0 will start movement, that must be stopped explicit by call to stop(). The function applys a basic algorithm to improve the straigthness of the movement. Lifting the robot from the desk may corrupt the results and is not recommended.
 
static void rotateClockwise (uint32_t rotateForMs=0, uint baseValue=DEFAULT_BASE_VALUE)
 Rotate clockwise for a certain amount of time. Call with moveForMs 0 will start movement, that must be stopped explicit by call to stop().
 
static void rotateAntiClockwise (uint32_t rotateForMs=0, uint baseValue=DEFAULT_BASE_VALUE)
 Rotate anticlockwise for a certain amount of time. Call with moveForMs 0 will start movement, that must be stopped explicit by call to stop().
 
static void stop (void)
 stops any current movement, no matter if timebased or endless
 
static void moveWithoutCorrection (uint32_t moveForMs=0, uint baseValue=DEFAULT_BASE_VALUE)
 Does the same as the move function, but this function does not apply any kind of algorithm to improve the result.
 

Static Public Attributes

static Motor left = Motor(MOTOR_LEFT_PIN,TIMER,CHANNEL_LEFT)
 
static Motor right = Motor(MOTOR_RIGHT_PIN,TIMER,CHANNEL_RIGHT)
 
static MotionDetection detection
 

Static Protected Member Functions

static void moveTask (void *args)
 
static void leftMotorTask (void *args)
 
static void rightMotorTask (void *args)
 

Static Protected Attributes

static uint16_t RIGHT_MOTOR_DUTY = DEFAULT_BASE_VALUE
 
static uint16_t LEFT_MOTOR_DUTY = DEFAULT_BASE_VALUE
 
static const int MOTOR_RIGHT_PIN = 11
 
static const int MOTOR_LEFT_PIN = 12
 
static TaskHandle_t xMoveTaskHandle = NULL
 
static TaskHandle_t xClockwiseTaskHandle = NULL
 
static TaskHandle_t xAntiClockwiseTaskHandle = NULL
 
static TickType_t xLastWakeTime
 
static FIFO_Packagebuffer = new FIFO_Package[64]
 
static int correctionThreshold = 150
 

Detailed Description

Definition at line 59 of file Motion.h.

Member Function Documentation

◆ begin()

void Motion::begin ( void )

Initialize the movement component.

Definition at line 18 of file Motion.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ leftMotorTask()

void Motion::leftMotorTask ( void * args)
staticprotected

Definition at line 108 of file Motion.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ move()

void Motion::move ( uint32_t moveForMs = 0,
uint baseValue = DEFAULT_BASE_VALUE )
static

Move forward for a certain amount of time. Call with moveForMs 0 will start movement, that must be stopped explicit by call to stop(). The function applys a basic algorithm to improve the straigthness of the movement. Lifting the robot from the desk may corrupt the results and is not recommended.

Parameters
moveForMsRepresenting the duration of forward moving in milliseconds.
baseValueThe value that is used to start with the calibrated movement. Defaults to 3900. If the Dezibot is not moving forward at all increasing the value may help. If the robot is just jumping up and down but not forward, try a lower value.

Definition at line 87 of file Motion.cpp.

+ Here is the call graph for this function:

◆ moveTask()

void Motion::moveTask ( void * args)
staticprotected

Definition at line 31 of file Motion.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ moveWithoutCorrection()

static void Motion::moveWithoutCorrection ( uint32_t moveForMs = 0,
uint baseValue = DEFAULT_BASE_VALUE )
static

Does the same as the move function, but this function does not apply any kind of algorithm to improve the result.

Parameters
moveForMshow many ms should the robot move, or 0 to let the robot move until another move command is mentioned, default is 0
baseValuethe duty value that is used for the movement, default is 0

◆ rightMotorTask()

void Motion::rightMotorTask ( void * args)
staticprotected

Definition at line 148 of file Motion.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rotateAntiClockwise()

void Motion::rotateAntiClockwise ( uint32_t rotateForMs = 0,
uint baseValue = DEFAULT_BASE_VALUE )
static

Rotate anticlockwise for a certain amount of time. Call with moveForMs 0 will start movement, that must be stopped explicit by call to stop().

Parameters
rotateForMsRepresenting the duration of rotating anticlockwise in milliseconds or 0 to let the robot turn until another movecommand is issued. Default is 0.
baseValueThe value that is used to start with the calibrated movement (not released yet, currently just the used value).

Definition at line 173 of file Motion.cpp.

+ Here is the call graph for this function:

◆ rotateClockwise()

void Motion::rotateClockwise ( uint32_t rotateForMs = 0,
uint baseValue = DEFAULT_BASE_VALUE )
static

Rotate clockwise for a certain amount of time. Call with moveForMs 0 will start movement, that must be stopped explicit by call to stop().

Parameters
rotateForMsRepresenting the duration of rotating clockwise in milliseconds, or 0 to rotate until another movecmd is issued. Default is 0
baseValueThe value that is used to start with the calibrated movement (not released yet, currently just the used value)

Definition at line 134 of file Motion.cpp.

+ Here is the call graph for this function:

◆ stop()

void Motion::stop ( void )
static

stops any current movement, no matter if timebased or endless

Definition at line 187 of file Motion.cpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ buffer

FIFO_Package* Motion::buffer = new FIFO_Package[64]
inlinestaticprotected

Definition at line 73 of file Motion.h.

◆ correctionThreshold

int Motion::correctionThreshold = 150
inlinestaticprotected

Definition at line 74 of file Motion.h.

◆ detection

MotionDetection Motion::detection
inlinestatic

Definition at line 82 of file Motion.h.

◆ left

Motor Motion::left = Motor(MOTOR_LEFT_PIN,TIMER,CHANNEL_LEFT)
inlinestatic

Definition at line 78 of file Motion.h.

◆ LEFT_MOTOR_DUTY

uint16_t Motion::LEFT_MOTOR_DUTY = DEFAULT_BASE_VALUE
inlinestaticprotected

Definition at line 62 of file Motion.h.

◆ MOTOR_LEFT_PIN

const int Motion::MOTOR_LEFT_PIN = 12
staticprotected

Definition at line 64 of file Motion.h.

◆ MOTOR_RIGHT_PIN

const int Motion::MOTOR_RIGHT_PIN = 11
staticprotected

Definition at line 63 of file Motion.h.

◆ right

Motor Motion::right = Motor(MOTOR_RIGHT_PIN,TIMER,CHANNEL_RIGHT)
inlinestatic

Definition at line 79 of file Motion.h.

◆ RIGHT_MOTOR_DUTY

uint16_t Motion::RIGHT_MOTOR_DUTY = DEFAULT_BASE_VALUE
inlinestaticprotected

Definition at line 61 of file Motion.h.

◆ xAntiClockwiseTaskHandle

TaskHandle_t Motion::xAntiClockwiseTaskHandle = NULL
inlinestaticprotected

Definition at line 70 of file Motion.h.

◆ xClockwiseTaskHandle

TaskHandle_t Motion::xClockwiseTaskHandle = NULL
inlinestaticprotected

Definition at line 69 of file Motion.h.

◆ xLastWakeTime

TickType_t Motion::xLastWakeTime
inlinestaticprotected

Definition at line 71 of file Motion.h.

◆ xMoveTaskHandle

TaskHandle_t Motion::xMoveTaskHandle = NULL
inlinestaticprotected

Definition at line 68 of file Motion.h.


The documentation for this class was generated from the following files: