254 lines
8.4 KiB
C
254 lines
8.4 KiB
C
/*==========================================================
|
||
File: Dynamic.h
|
||
Prupose: Dynamic parameters of a connection
|
||
Author: Yann Le Tensorer
|
||
Creation Date: 29 january 1997
|
||
Revision : Yann Le Tensorer
|
||
04 february 1997
|
||
Added function fn_vDynamicObject_GetParams
|
||
Version 1.01
|
||
===========================================================*/
|
||
|
||
#include "acp_base.h"
|
||
#include "mth_real.h"
|
||
|
||
#ifndef __DYNA_H__
|
||
#define __DYNA_H__
|
||
|
||
#define C_ucNone 0
|
||
#define C_ucConst 1
|
||
#define C_ucLinear 2
|
||
#define C_ucSinus 3
|
||
|
||
typedef struct _ACP_tdstDynaParam
|
||
{
|
||
unsigned char ucDynamicType;
|
||
unsigned char ucSamplingRate;
|
||
MTH_tdxReal xSpeed;
|
||
MTH_tdxReal xStartSpeed;
|
||
MTH_tdxReal xStartAngle;
|
||
MTH_tdxReal xEndAngle;
|
||
MTH_tdxReal xEndSpeed;
|
||
MTH_tdxReal xMaxSpeed;
|
||
MTH_tdxReal* d_stListOfSpeeds;
|
||
|
||
} ACP_tdstDynaParam;
|
||
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
|
||
/*==========================================================
|
||
Function name: fn_vDynamicObject_Calculate
|
||
Description: Caculates the speeds at sampled points, according to dynamic parameters
|
||
Input: p_stDynaParam: pointer to a pre-created tdstDynaParam structure
|
||
Output: none
|
||
Author: Yann Le Tensorer
|
||
Date: 30 january 1997
|
||
Revision:
|
||
==========================================================*/
|
||
void fn_vDynamicObject_Calculate(ACP_tdstDynaParam* p_stDynaParam);
|
||
|
||
|
||
/*==========================================================
|
||
Function name: fn_vDynamicObject_Create
|
||
Description: Creates a dynamic parameters object
|
||
Input: p_stDynaParam: pointer to a preallocated tdstDynaParam structure
|
||
ucSamplingRate: sampling rate
|
||
ucDynamicType: dynamic type (C_NONE,C_CONST,C_LINEAR,C_SINUS)
|
||
xFirst,xSecond,xThird: See table below
|
||
|
||
Type: | C_NONE | C_CONST | C_LINEAR | C_SINUS
|
||
===========================================================
|
||
xFirst | - | speed | start speed | start angle
|
||
| | | |
|
||
xSecond | - | - | end speed | end angle
|
||
| | | |
|
||
xThird | - | - | - | max speed
|
||
|
||
|
||
Output: none
|
||
Author: Yann Le Tensorer
|
||
Date: 30 january 1997
|
||
Revision:
|
||
==========================================================*/
|
||
|
||
void fn_vDynamicObject_Create( ACP_tdstDynaParam* p_stDynaParam,
|
||
unsigned char ucSamplingRate,
|
||
unsigned char ucDynamicType,
|
||
MTH_tdxReal xFirst,
|
||
MTH_tdxReal xSecond,
|
||
MTH_tdxReal xThird);
|
||
|
||
|
||
|
||
/*==========================================================
|
||
Function name: fn_vDynaParams_Free
|
||
Description: removes the allocated ram for DynaParams
|
||
Input: p_stDynaParam: pointer to a pre-created tdstDynaParam structure
|
||
Output: none
|
||
Author: Yann Le Tensorer
|
||
Date: 30 january 1997
|
||
Revision:
|
||
==========================================================*/
|
||
void fn_vDynamicObject_Free(ACP_tdstDynaParam* p_stDynaParam);
|
||
|
||
|
||
/*==========================================================
|
||
Function name: fn_vDynamicObject_ChangeParams
|
||
Description: changes the dynamic parameters (except sampling rate)
|
||
Input: p_stDynaParam: pointer to a preallocated tdstDynaParam structure
|
||
ucDynamicType: dynamic type (C_ucNone,C_ucConst,C_ucLinear,C_ucSinus)
|
||
xFirst,xSecond,xThird: See table below
|
||
|
||
Type: | C_ucNone | C_ucConst | C_ucLinear | C_ucSinus
|
||
===========================================================
|
||
xFirst | - | speed | start speed | start angle
|
||
| | | |
|
||
xSecond | - | - | end speed | end angle
|
||
| | | |
|
||
xThird | - | - | - | max speed
|
||
|
||
|
||
Output: none
|
||
Author: Yann Le Tensorer
|
||
Date: 30 january 1997
|
||
Revision:
|
||
==========================================================*/
|
||
|
||
void fn_vDynamicObject_ChangeParams( ACP_tdstDynaParam* p_stDynaParam,
|
||
unsigned char ucDynamicType,
|
||
MTH_tdxReal xFirst,
|
||
MTH_tdxReal xSecond,
|
||
MTH_tdxReal xThird);
|
||
|
||
|
||
/*==========================================================
|
||
Function name: fn_vDynamicObject_GetParams
|
||
Description: Gets the dynamic parameters (including sampling rate)
|
||
Input: p_stDynaParam: pointer to a preallocated tdstDynaParam structure
|
||
p_ucDynamicType:pointer to get dynamic type (C_ucNone,C_ucConst,C_ucLinear,C_ucSinus)
|
||
p_SamplingRate: pointer to get sampling rate
|
||
p_xFirst,p_xSecond,p_xThird:pointers to parameters to get See table below
|
||
|
||
Type: | C_ucNone | C_ucConst | C_ucLinear | C_ucSinus
|
||
===========================================================
|
||
xFirst | - | speed | start speed | start angle
|
||
| | | |
|
||
xSecond | - | - | end speed | end angle
|
||
| | | |
|
||
xThird | - | - | - | max speed
|
||
|
||
|
||
Output: none
|
||
Author: Yann Le Tensorer
|
||
Date: 04 february 1997
|
||
Revision:
|
||
==========================================================*/
|
||
|
||
void fn_vDynamicObject_GetParams( ACP_tdstDynaParam* p_stDynaParam,
|
||
unsigned char* p_ucDynamicType,
|
||
unsigned char* p_ucSamplingRate,
|
||
MTH_tdxReal* p_xFirst,
|
||
MTH_tdxReal* p_xSecond,
|
||
MTH_tdxReal* p_xThird);
|
||
|
||
/*==========================================================
|
||
Function name: fn_xDynamicObject_GetSpeed
|
||
Description: returns the speed at a given sample (n<> of the point)
|
||
Input: p_stDynaParam: pointer to a pre-created tdstDynaParam structure
|
||
ucSampleNo: n<> of the point to get the speed from.
|
||
Output: return value is the speed.
|
||
Author: Yann Le Tensorer
|
||
Date: 31 january 1997
|
||
Revision:
|
||
==========================================================*/
|
||
MTH_tdxReal fn_xDynamicObject_GetSpeed(ACP_tdstDynaParam* p_stDynaParams,unsigned char ucSampleNo);
|
||
|
||
|
||
/*==========================================================
|
||
Function name: fn_vDynamicObject_ChangeSamplingRate
|
||
Description: Changes the sampling rate of a dynamic object
|
||
Input: p_stDynaParam: pointer to a preallocated tdstDynaParam structure
|
||
ucSamplingRate: sampling rate
|
||
Output: none
|
||
Author: Yann Le Tensorer
|
||
Date: 5 february 1997
|
||
Revision:
|
||
==========================================================*/
|
||
|
||
void fn_vDynamicObject_ChangeSamplingRate( ACP_tdstDynaParam* p_stDynaParam,
|
||
unsigned char ucSamplingRate);
|
||
|
||
/*==========================================================
|
||
Function name: fn_vDynamicObject_CreateNotSampled
|
||
Description: Creates a dynamic parameters object for not sampled type
|
||
Input: p_stDynaParam: pointer to a preallocated tdstDynaParam structure
|
||
ucDynamicType: dynamic type (C_NONE,C_CONST,C_LINEAR,C_SINUS)
|
||
xFirst,xSecond,xThird: See table below
|
||
|
||
Type: | C_NONE | C_CONST | C_LINEAR | C_SINUS
|
||
===========================================================
|
||
xFirst | - | speed | start speed | start angle
|
||
| | | |
|
||
xSecond| - | - | end speed | end angle
|
||
| | | |
|
||
xThird | - | - | - | max speed
|
||
|
||
|
||
Output: none
|
||
Author: Albert Pais
|
||
Date: February 04, 1997
|
||
Revision:
|
||
==========================================================*/
|
||
void fn_vDynamicObject_CreateNotSampled
|
||
(
|
||
ACP_tdstDynaParam* /*p_stDynaParam*/,
|
||
unsigned char /*ucDynamicType*/,
|
||
MTH_tdxReal /*xFirst*/,
|
||
MTH_tdxReal /*xSecond*/,
|
||
MTH_tdxReal /*xThird*/
|
||
);
|
||
|
||
/*==========================================================
|
||
Function name: fn_vDynamicObject_CalculateNotSampled
|
||
Description: Caculates specific coef when speed is not sampled
|
||
Input:
|
||
p_stDynaParam: pointer to a pre-created tdstDynaParam structure
|
||
the initial dist beetween the initial point and the final point
|
||
Output: none
|
||
Remark :
|
||
The xSpeed field of the structure is used to store some
|
||
parameters used at execution
|
||
Author: Albert Pais
|
||
Date: Frebruary 4,1997
|
||
Revision:
|
||
==========================================================*/
|
||
void fn_vDynamicObject_CalculateNotSampled
|
||
(
|
||
ACP_tdstDynaParam* /*_p_stDynaParam*/,
|
||
MTH_tdxReal /*_xInitialDist*/
|
||
);
|
||
/*==========================================================
|
||
Function name: fn_xDynamicObject_GetSpeedNotSampled
|
||
Description: returns the speed at a given position when it is not sampled
|
||
Input:
|
||
p_stDynaParam: pointer to a pre-created tdstDynaParam structure
|
||
_xDist : the dist beetween the position where speed is required and the point to reach
|
||
Output: return value is the speed.
|
||
Author: Albert Pais
|
||
Date: February 4,1997
|
||
Revision:
|
||
==========================================================*/
|
||
MTH_tdxReal fn_xDynamicObject_GetSpeedNotSampled
|
||
(
|
||
ACP_tdstDynaParam* /*_p_stDynaParams*/,
|
||
MTH_tdxReal /*_xDist*/
|
||
);
|
||
|
||
|
||
#ifdef __cplusplus
|
||
}
|
||
#endif
|
||
|
||
#endif |