00001 #include "saphira.h"
00002 #include "windows.h"
00003 #include "process.h"
00004 #include "io.h"
00005 #include "fcntl.h"
00006
00007 #define paiRobotBase sfRobot
00008
00009 #define DLL_EXPORT extern "C" __declspec(dllexport)
00010 #define DLL_IMPORT extern "C" __declspec(dllimport)
00011 #define STD __stdcall
00012 #define ESCALA 0.089473
00013
00015
00017
00018
00025 typedef struct {
00027 double x;
00029 double y;
00031 double th;
00033 double Velocidad;
00035 double RadioExito;
00036 }PassToThreadType;
00037
00043 typedef struct {
00045 double Prioridad;
00047 double TimeOut;
00050 double Suspendido;
00052 double Velocidad;
00053 }ConstantVelocityType;
00054
00060 typedef struct {
00062 double Prioridad;
00064 double TimeOut;
00067 double Suspendido;
00069 double VelocidadCauta;
00071 double Sensibilidad;
00072 }KeepOffType;
00073
00079 typedef struct {
00081 double Prioridad;
00083 double TimeOut;
00086 double Suspendido;
00088 double SensibilidadFrontal;
00090 double SensibilidadLateral;
00092 double GananciaGiro;
00094 double RadioSeguridad;
00095 }AvoidCollisionType;
00096
00102 typedef struct {
00104 double Prioridad;
00106 double TimeOut;
00109 double Suspendido;
00110 }StopType;
00111
00116 typedef struct {
00117 AvoidCollisionType AvoidCollisionParams;
00118 KeepOffType KeepOffParams;
00119 ConstantVelocityType ConstantVelocityParams;
00120 StopType StopParams;
00121 }BehaviorsParams;
00122
00124
00126
00127 sfprocess *ComportamientoVel=NULL,*ComportamientoColision=NULL;
00128 bool ThreadFinished=false;
00129 PassToThreadType Valores;
00130
00132
00134
00135 DLL_EXPORT long STD ConexionConRobot (long TipoConexion, double XPosInic ,
00136 double YPosInic, double Heading, char *DireccionIP);
00137 DLL_EXPORT void STD DesconexionRobot (void);
00138 DLL_EXPORT void STD GirarRobotDerecha (long velocidad);
00139 DLL_EXPORT void STD GirarRobotIzquierda (long velocidad);
00140 DLL_EXPORT void STD GirarRobotHastaAnguloN (double Angulo);
00141 DLL_EXPORT void STD DetenerGiroRobot (void);
00142 DLL_EXPORT void STD AvanzarRobot (long velocidad);
00143 DLL_EXPORT void STD RetrocederRobot (long velocidad);
00144 DLL_EXPORT void STD DetenerTraslacionRobot (void);
00145 DLL_EXPORT void STD GetRobotPosition (double *PosX,double *PosY,double *Heading);
00146 DLL_EXPORT void STD CargarBehaviors (BehaviorsParams *Parametros);
00147 DLL_EXPORT void STD DescargarBehaviors ();
00148 DLL_EXPORT void STD Behav_Loaded (char *NombreFichero, char *NombreInstancia);
00149 DLL_EXPORT void STD Behav_Kill (char *NombreInstancia);
00150 DLL_EXPORT void STD Behav_Resume (char *NombreInstancia);
00151 DLL_EXPORT void STD Behav_Pause (char *NombreInstancia);
00152 DLL_EXPORT void STD SeguirSpline (long x,long y,long th,double vel,double radio);
00153 DLL_EXPORT int STD ThreadState (void);
00154
00155 int paiRobotStartup(int channel, char *name, HANDLE hInst, int nCmdShow);
00156 void myStartupFn(void);
00157 void myConnectFn(void);
00158 void ThreadSeguirSpline (void *Datos);
00159