lebai-motion-control  3.1.6
lebai motion control C interface
Data Structures | Typedefs | Enumerations | Functions
lmc_tg.h File Reference

Trajectory generator related data structures and functions. More...

#include <motion_control/lmc_robot_model.h>
#include <motion_control/lmc_joint.h>
#include <motion_control/lmc_tg_config.h>
#include <stdbool.h>
Include dependency graph for lmc_tg.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  lmc_tg_update_ret
 Trjecotry generator update ret value. More...
 
struct  lmc_tg_runtime_data
 Trjecotry generator runtime data. More...
 
struct  lmc_tg_move_param
 Trjecotry generator move parameter. More...
 
struct  lmc_tg_speed_param
 Trjecotry generator speed parameter. More...
 
struct  lmc_tg_toward_param
 Trjecotry generator toward parameter. More...
 

Typedefs

typedef struct lmc_tg lmc_tg_t
 Trajectory generator data structure. More...
 
typedef enum lmc_tg_update_state lmc_tg_update_state_t
 Trajectory generator update state. More...
 
typedef enum lmc_tg_buffer_ret lmc_tg_buffer_ret_t
 trjecotry generator buffer xxx function ret More...
 
typedef enum lmc_tg_update_error_code lmc_tg_update_error_code_t
 Trjecotry generator update error code, when error happens, check the type for error. More...
 
typedef struct lmc_tg_update_ret lmc_tg_update_ret_t
 Trjecotry generator update ret value. More...
 
typedef enum lmc_tg_group_type lmc_tg_group_type_t
 Trjecotry generator group type. More...
 
typedef enum lmc_tg_space_type lmc_tg_space_type_t
 Trajectory generator space type. More...
 
typedef struct lmc_tg_runtime_data lmc_tg_runtime_data_t
 Trjecotry generator runtime data. More...
 
typedef struct lmc_tg_move_param lmc_tg_move_param_t
 Trjecotry generator move parameter. More...
 
typedef struct lmc_tg_speed_param lmc_tg_speed_param_t
 Trjecotry generator speed parameter. More...
 
typedef struct lmc_tg_toward_param lmc_tg_toward_param_t
 Trjecotry generator toward parameter. More...
 

Enumerations

enum  lmc_tg_update_state { TGS_RUNNING, TGS_IDLE, TGS_ERROR }
 Trajectory generator update state. More...
 
enum  lmc_tg_buffer_ret {
  BUFFER_RET_SUCCESS, BUFFER_RET_FULL, BUFFER_RET_IGNORE, BUFFER_RET_INTERNAL_ERROR,
  BUFFER_RET_COMPUTE_ERROR, BUFFER_RET_CIRCLE_AFTER_UNDERMINIED_TRAJ, BUFFER_RET_CIRCLE_COMPUTE_ERROR, BUFFER_RET_UNTIL_BLEND_CONFLICT,
  BUFFER_RET_TRAJ_IK_ERROR, BUFFER_RET_MISMATCH_GROUP, BUFFER_RET_VEL_EXCEED, BUFFER_RET_PT_ERROR,
  BUFFER_RET_PUSH_BUFFER_ERROR
}
 trjecotry generator buffer xxx function ret More...
 
enum  lmc_tg_update_error_code {
  UPDATE_RET_NO_ERROR = 0, UPDATE_RET_IK_ERROR = -1, UPDATE_RET_SINGULARITY_ERROR = -2, UPDATE_RET_JOINT_POS_LOGIC_ERROR = -3,
  UPDATE_INTERNAL_ERROR = -4
}
 Trjecotry generator update error code, when error happens, check the type for error. More...
 
enum  lmc_tg_group_type { COMMON, PIECEWISE, TOWARD, SINGROBUST }
 Trjecotry generator group type. More...
 
enum  lmc_tg_space_type { JOINT, CARTESIAN }
 Trajectory generator space type. More...
 

Functions

lmc_tg_tlmc_tg_new ()
 Create a trajectory generator instance. More...
 
void lmc_tg_delete (lmc_tg_t **tg_addr)
 Delete a trajectory generator instance. More...
 
int lmc_tg_init (lmc_tg_t *const tg, lmc_robot_model_t const *const robot_model, lmc_tg_config_t const *const config)
 Init a trajectory generator. More...
 
void lmc_tg_cleanup (lmc_tg_t *const tg)
 Cleanup all runtime data of trajectory generator. More...
 
int lmc_tg_set_limit (lmc_tg_t *const tg, lmc_tg_limit_t const *const limit)
 Set trajectory generator limit parameters. More...
 
void lmc_tg_set_joint_pos (lmc_tg_t *const tg, lmc_joint_state_t const *const joint_state)
 This function set current joint anchor point of trajectory generator caculation. It must be called when trajectory is in idle.If it's not in idle state, theis function has no effect. More...
 
int lmc_tg_set_group (lmc_tg_t *const tg, lmc_tg_group_type_t group)
 This function set group, group change must be done by manual. The trajectory type under current group can be buffered(or set). If type mismatch, buffer failed. One should only call the function when trajecoty generator is in idle state. More...
 
lmc_tg_group_type_t lmc_tg_get_group (lmc_tg_t *const tg)
 This function get current group. More...
 
void lmc_tg_recovery (lmc_tg_t *const tg)
 This function recover the error, only call this function when the trajectory update in error state. More...
 
lmc_tg_update_ret_t lmc_tg_update (lmc_tg_t *const tg)
 Core calculation function of trajectory generator, always call it in realtime loop,. More...
 
int lmc_tg_get_updated_date (lmc_tg_t const *const tg, lmc_joint_cmd_t *const joint_cmd, lmc_tg_runtime_data_t *const tg_runtime_data)
 Get usefull trajectory generator update data. More...
 
lmc_tg_update_state_t lmc_tg_get_update_state (lmc_tg_t const *const tg)
 Get trajectory generator update state. More...
 
lmc_tg_buffer_ret_t lmc_tg_buffer_move_joint (lmc_tg_t *const tg, int id, double const *const target, lmc_tg_move_param_t const *const param)
 Try to add a move joint trajectory to buffer. More...
 
lmc_tg_buffer_ret_t lmc_tg_buffer_move_line (lmc_tg_t *const tg, int id, lmc_transform_t const *const target, lmc_tg_move_param_t const *const param)
 Try to add a move line trajectory to buffer. More...
 
lmc_tg_buffer_ret_t lmc_tg_buffer_move_circle (lmc_tg_t *const tg, int id, lmc_translation_t const *const way_point, lmc_transform_t const *const target, lmc_tg_move_param_t const *const param)
 Try to add a move circle trajectory to buffer using way point and end pose. More...
 
lmc_tg_buffer_ret_t lmc_tg_buffer_move_circle_by_angle (lmc_tg_t *const tg, int id, lmc_translation_t const *const way_point1, lmc_translation_t const *const way_point2, double angle, lmc_euler_zyx_t const *const target_rot, lmc_tg_move_param_t const *const param)
 Try to add a move circle trajectory to buffer using two way point and angle. More...
 
lmc_tg_buffer_ret_t lmc_tg_buffer_speed_joint (lmc_tg_t *const tg, int id, double const *const vel, lmc_tg_speed_param_t const *const param)
 Try to add a speed joint trajectory to buffer. More...
 
lmc_tg_buffer_ret_t lmc_tg_buffer_speed_line (lmc_tg_t *const tg, int id, lmc_twist_t const *const t, lmc_tg_speed_param_t const *const param)
 Try to add a speed linear trajectory to buffer. More...
 
lmc_tg_buffer_ret_t lmc_tg_buffer_move_joint_pt (lmc_tg_t *const tg, int id, double duration, lmc_joint_cmd_t const *const joint_data)
 Try to add a joint move pt trajectory. More...
 
lmc_tg_buffer_ret_t lmc_tg_buffer_move_joint_pvt (lmc_tg_t *const tg, int id, double duration, lmc_joint_cmd_t const *const joint_data)
 Try to add a joint move pvt trajectory. More...
 
lmc_tg_buffer_ret_t lmc_tg_buffer_move_joint_pvat (lmc_tg_t *const tg, int id, double duration, lmc_joint_cmd_t const *const joint_data)
 Try to add a joint move pvat trajectory. More...
 
lmc_tg_buffer_ret_t lmc_tg_set_toward_joint (lmc_tg_t *const tg, int id, double const *const target, lmc_tg_toward_param_t const *const param)
 Try to set new toward joint target. More...
 
lmc_tg_buffer_ret_t lmc_tg_buffer_singularity_robust_move_line (lmc_tg_t *const tg, int id, lmc_transform_t const *const target, lmc_tg_move_param_t const *const param)
 Try to add a singlarirty robust move line trajectory to buffer. This trajectory will try to avoid singularity. More...
 
void lmc_tg_stop_trajectory (lmc_tg_t *const tg)
 This function stop the trajecotry with an deceleration. More...
 
void lmc_tg_interrupt_trajectory (lmc_tg_t *const tg)
 This function interrupt current running the trajecotry if it's interruptable. After current trajectory is interrupted, if there is trajectory in buffer, it will start next trajectory immediately. More...
 
void lmc_tg_set_vel_scale (lmc_tg_t *const tg, double scale)
 Set the velocity scale of trajectory data range from 0.0 to 1.0. More...
 
void lmc_tg_release_control (lmc_tg_t *const tg, double t)
 Give up the control of trajectory generator, the trajectory generator will output as lmc_tg_update_joint_state. for while, and keep it. More...
 
void lmc_tg_sieze_control (lmc_tg_t *const tg, double vel_scale)
 Sieze the control after release it. it will move from current position to the position when release, and then continue the trajectory. More...
 
size_t lmc_tg_get_buffer_size (lmc_tg_t const *const tg)
 Get number of buffered trajectory . More...
 
int lmc_tg_get_buffer_empty (lmc_tg_t const *const tg)
 Get if buffer is empty. More...
 
int lmc_tg_get_buffer_full (lmc_tg_t const *const tg)
 Get if buffer is full. More...
 
double lmc_tg_get_remain_move_time (lmc_tg_t const *const tg)
 Get total time to move remain trajectoies in buffer. More...
 
int lmc_tg_update_joint_state (lmc_tg_t *const tg, lmc_joint_state_t const *const joint_state)
 Update trajectory generator joint state, should be called in realtime loop, update every cycle. This is used when trajectory generator wants to know the joint actual pos, vel torque information. More...
 

Detailed Description

Trajectory generator related data structures and functions.

Author
liufang
Date
2021-07-23

Definition in file lmc_tg.h.