SPRACC6 November 2020 TDA3LA , TDA3LX , TDA3MA , TDA3MD , TDA3MV
/********************************************************* Include Files**********************************************************/#include "drawRearviewLink_priv.h"#include <include/link_api/system_common.h>#include <src/rtos/utils_common/include/utils_mem.h>#define L (110.2*9)//Wheelbase: 110.2"#define W (61.0*9) //Rear wheel tread: 61.0"#define W2 (W/2.0)
In the drawRearviewLink_DynamicLines.c file, the L macro corresponds to the wheelbase of the car in inches, and W corresponds to the rear wheel tread. As mentioned previously, a conversion factor of 9 pixels to 1 inch is used in this demo.
void AlgorithmLink_drawAckermannSteering(AlgorithmLink_drawRearviewObj *pObj)
{
AlgorithmLink_RearviewOverlayDrawObj *pRearViewOverlayDrawObj;
pRearViewOverlayDrawObj = &pObj->rearViewOverlayDrawObj;
// Compile Time Inputs
Int32 x0Driver = 200;
Int32 x0Pass = x0Driver + W;
Int32 y0 = Y0;
float q = 0.003378;
In the AlgorithmLink_drawAckermannSteering function in the same file, the variable q controls the point at which the perspective transform converges.
/************************************************* Data structures**************************************************/typedef struct {
Bool isFirstTime; /* Are we invoking the draw API for this first time */
Bool displayTopView;
UInt32 state;
UInt32 prevState;
UInt32 delay;
Int32 aLong; // Variable for ellipse steering model
Int32 steeringAngle;
Bool turningDir; // TRUE = Right Turn; FALSE = Left Turn
Bool drawBuf;
/* If TRUE will draw from Buffer arrays below, else generate points, fill buffer, then draw*/short iDriver;
short iPass;
Int32 xDriverBuf[DISCRETE_RES];
Int32 yDriverBuf[DISCRETE_RES];
Int32 xPassBuf[DISCRETE_RES];
Int32 yPassBuf[DISCRETE_RES];
} AlgorithmLink_RearviewOverlayDrawObj;
In the drawRearview_priv.h file, the structs AlgorithmLink_drawRearviewObj and its member AlgorithmLink_RearviewOverlayDrawObj (shown previously) are declared. The steeringAngle and turningDir members of AlgorithmLink_RearviewOverlayDrawObj should be updated by input from the CAN bus.