#include <sys/time.h>
#include <time.h>
#include "trgen.h"
#include "balet.h"
#include "robodata.h"
#include <robot.h>
#include <pthread.h>
#include <path_planner.h>
#include <signal.h>
#include <movehelper.h>
#include <sharp.h>
#include <unistd.h>
#include <map.h>
#include "robot_config.h"
#include <robomath.h>
#include <ul_log.h>
#include "motion-control.h"
#include <ekf.h>
#include <geom.h>
Defines | |
#define | DBG(format,...) |
#define | DBGflush() |
#define | MOTION_CONTROL |
#define | SOUND_VELOCITY (331.3+0.606*20) |
#define | XCORR2METER (SOUND_VELOCITY*(127.0/508.0)/3000.0) |
#define | D_MAX (XCORR2METER*508.0) |
#define | MAX_POS_ERROR_M 0.25 |
If the distance of robot's estimated position from robot's requested position if above this value, the robot lost and we try to reset localization. | |
#define | CLOSE_TO_TARGET_M 0.1 |
If trajectory end is reached and robot's estimated position is closer than this distance, the movement is considered as "done". | |
#define | MOTION_PERIOD_NS (50/*ms*/*1000*1000) |
#define | MEASURE_TIMEOUT_NS (100/*ms*/*1000*1000) |
#define | SIG_DO_CONTROL_NOW (SIGRTMIN+1) |
Functions | |
UL_LOG_CUST (ulogd_motion_control) | |
void * | thread_trajectory_follower (void *arg) |
A thread running the controller. | |
void | go (Trajectory *t, double append_time) |
Tells trajctory_follower to start moving along trajectory t . | |
void | stop () |
switches to newly calculated trajectory to go on it at specific time | |
int | motion_control_init () |
Initializes motion controller. | |
void | motion_control_done () |
void | get_future_pos (double rel_time_sec, Pos &pos, double &switch_time) |
Variables | |
struct balet_params | k |
sem_t | recalculation_not_running |
sem_t | measurement_received |
int | measurement_ok = 0 |
Determines way of thread_trajectory_follower() operation:
|
#define CLOSE_TO_TARGET_M 0.1 |
If trajectory end is reached and robot's estimated position is closer than this distance, the movement is considered as "done".
#define D_MAX (XCORR2METER*508.0) |
#define DBG | ( | format, | ||
... | ||||
) |
#define DBGflush | ( | ) |
#define MAX_POS_ERROR_M 0.25 |
If the distance of robot's estimated position from robot's requested position if above this value, the robot lost and we try to reset localization.
#define MEASURE_TIMEOUT_NS (100/*ms*/*1000*1000) |
#define MOTION_CONTROL |
#define MOTION_PERIOD_NS (50/*ms*/*1000*1000) |
#define SIG_DO_CONTROL_NOW (SIGRTMIN+1) |
#define SOUND_VELOCITY (331.3+0.606*20) |
#define XCORR2METER (SOUND_VELOCITY*(127.0/508.0)/3000.0) |
void get_future_pos | ( | double | rel_time_sec, | |
Pos & | pos, | |||
double & | switch_time | |||
) |
void go | ( | Trajectory * | t, | |
double | append_time | |||
) |
Tells trajctory_follower to start moving along trajectory t
.
t | Trajectory to follow. | |
append_time | Relative time from the beginning of the actual_trajectory when to append the new one |
void motion_control_done | ( | void | ) |
int motion_control_init | ( | void | ) |
Initializes motion controller.
void stop | ( | void | ) |
switches to newly calculated trajectory to go on it at specific time
void* thread_trajectory_follower | ( | void * | arg | ) |
A thread running the controller.
This (high priority) thread executes the motion control algorithm. It calculates repference position based on actual trajectory and current time. Then it calls "balet" controller to close feedback.
arg |
UL_LOG_CUST | ( | ulogd_motion_control | ) |
struct balet_params k |
{ p_tangent: 3, p_angle: 2, p_perpen: 5 }
int measurement_ok = 0 |
Determines way of thread_trajectory_follower() operation:
sem_t measurement_received |