⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 m6e_api.h

📁 使用VC写的关于windows和linux之间利用套接字实现通讯的源代码
💻 H
字号:
/*************************************************************************
**    Grandar Robotics Co.,Ltd
**************************************************************************
**
**   $Workfile: m6e_api.h $
**    Summary : AS-MRobot6E interface
** 
**   $Revision: 1.0 $
**       State:
**       $Date: 11.21.06 9:52 $
**   Compiler : Microsoft Visual C++ 6.0
**      Author: wang
**
**************************************************************************
**
**  Remarks   : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
**              ! Use only for 32Bit Versions of windows !
**              !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
**
**************************************************************************
**    all rights reserved
*************************************************************************/
#ifndef GRANDAR_M6E_API_H
#define GRANDAR_M6E_API_H

#define M6EDLLVERSION 0x1000
#define MAX_MODULES 31
#define MAX_MODULESID 127

#if defined (_WIN32)
#ifndef WINAPI
	#define WINAPI __stdcall
#endif

#ifdef M6E_API_EXPORTS
	#define M6EDLL_API __declspec(dllexport)
#else
	#define M6EDLL_API __declspec(dllimport)
#endif
#endif //#if defined (_WIN32)


//-----------------------------------------------------------------------
// invalid value
//-----------------------------------------------------------------------

//-----------------------------------------------------------------------
// MRobot6E Module States
//-----------------------------------------------------------------------
#define STATEID_MOD_ERROR						0x00000001L
#define STATEID_MOD_HOME						0x00000002L
#define STATEID_MOD_HALT						0x00000004L
#define STATEID_MOD_MOTION						0x00000008L
#define STATEID_MOD_RAW				   	        0x00000010L
#define STATEID_MOD_INIT					    0x00000020L
#define STATEID_MOD_HOMING					    0x00000040L

//-----------------------------------------------------------------------
// MRobot6E Module Types
//-----------------------------------------------------------------------
#define	TYPEID_MOD_ROTARY						0x0f
#define TYPEID_MOD_LINEAR						0xf0

//-----------------------------------------------------------------------
// MRobot6E Module Baudrates
//-----------------------------------------------------------------------
#define BAUDRATEID_MOD_CAN_125K					0
#define BAUDRATEID_MOD_CAN_250K					1
#define BAUDRATEID_MOD_CAN_500K					2
#define BAUDRATEID_MOD_CAN_800K                 3
#define BAUDRATEID_MOD_CAN_1000K				4

//-----------------------------------------------------------------------
// MRobot6E Device Error Codes
//-----------------------------------------------------------------------
#define ERRID_NOERR                         (0L   )
#define	ERRID_DEV							(-200L)		// device error
#define ERRID_DEV_FUNCTIONNOTAVAILABLE  	(ERRID_DEV - 1 )	
#define ERRID_DEV_NOINITSTRING				(ERRID_DEV - 2 )
#define ERRID_DEV_NODEVICENAME				(ERRID_DEV - 3 )
#define ERRID_DEV_BADINITSTRING				(ERRID_DEV - 4 )
#define ERRID_DEV_INITERROR					(ERRID_DEV - 5 )
#define ERRID_DEV_NOTINITIALIZED			(ERRID_DEV - 6 )
#define ERRID_DEV_WRITEERROR				(ERRID_DEV - 7 )
#define ERRID_DEV_READERROR					(ERRID_DEV - 8 )
#define ERRID_DEV_WRITETIMEOUT				(ERRID_DEV - 9 )
#define ERRID_DEV_READTIMEOUT				(ERRID_DEV - 10)
#define ERRID_DEV_WRONGMESSAGEID			(ERRID_DEV - 11)
#define ERRID_DEV_WRONGCOMMANDID			(ERRID_DEV - 12)
#define ERRID_DEV_WRONGPARAMETERID			(ERRID_DEV - 13)
#define ERRID_DEV_EXITERROR					(ERRID_DEV - 14)
#define ERRID_DEV_NOMODULES					(ERRID_DEV - 15)
#define ERRID_DEV_WRONGDEVICEID				(ERRID_DEV - 16)
#define ERRID_DEV_NOLIBRARY					(ERRID_DEV - 17)
#define ERRID_DEV_ISINITIALIZED				(ERRID_DEV - 18)
#define ERRID_DEV_WRONGEMSMODULEID			(ERRID_DEV - 19)
#define ERRID_DEV_EMSNOTINITIALIZED			(ERRID_DEV - 20)
#define ERRID_DEV_EMSMAXNUMBER				(ERRID_DEV - 21)
#define ERRID_DEV_EMSINITERROR				(ERRID_DEV - 22)
#define ERRID_DEV_WRONGEMSTYPE				(ERRID_DEV - 23)
#define ERRID_DEV_WRONGEMSCHANNELID			(ERRID_DEV - 24)
#define ERRID_DEV_WRONGMP55MODULEID			(ERRID_DEV - 25)
#define ERRID_DEV_WRONGSCHUNKMODULEID		(ERRID_DEV - 26)
#define ERRID_DEV_WRONGMODULEID				(ERRID_DEV - 27)
#define ERRID_DEV_MODULEERROR				(ERRID_DEV - 28)
#define ERRID_DEV_WAITTIMEOUT				(ERRID_DEV - 29)
#define ERRID_DEV_OPENINIFILE				(ERRID_DEV - 30)
#define ERRID_DEV_BEYOND_HARD				(ERRID_DEV - 31)
#define ERRID_DEV_BEYOND_SOFT				(ERRID_DEV - 32)
#define ERRID_DEV_VOLT_OVER				    (ERRID_DEV - 33)
#define ERRID_DEV_CURR_OVER                 (ERRID_DEV - 34)
#define ERRID_DEV_HOT_OVER                  (ERRID_DEV - 35)
#define ERRID_DEV_USER_ERROR                (ERRID_DEV - 36)

#ifdef __cplusplus
extern "C" {
#endif

//-----------------------------------------------------------------------
// data structure
//-----------------------------------------------------------------------
typedef struct
{
	int iModuleId;
	float fPos;
	unsigned short uiTime;

}M6E_MOTIONDATA,*PM6E_MOTIONDATA;

//-----------------------------------------------------------------------
// API interface
//-----------------------------------------------------------------------

M6EDLL_API int WINAPI RobotE_openDevice    ( int* piDeviceId, const char* acInitString );
M6EDLL_API int WINAPI RobotE_closeDevice   ( int  iDeviceId );
M6EDLL_API int WINAPI RobotE_getDeviceCount( void          );//reserved interface
M6EDLL_API int WINAPI RobotE_getDeviceIdMap( int* aiIdMap  );//reserved interface
M6EDLL_API int WINAPI RobotE_closeDevices  ( void          );//reserved interface

/************************************模块信息和状态的获取**************************************/

M6EDLL_API int WINAPI RobotE_getModuleCount   ( int iDeviceId               );
M6EDLL_API int WINAPI RobotE_getModuleIdMap   ( int iDeviceId, int* aiIdMap );
M6EDLL_API int WINAPI RobotE_getModuleState   ( int iDeviceId, int iModuleId, unsigned long*  puiState  );
M6EDLL_API int WINAPI RobotE_getModuleType    ( int iDeviceId, int iModuleId, unsigned char*  pucValue  );
M6EDLL_API int WINAPI RobotE_getModuleVersion ( int iDeviceId, int iModuleId, unsigned short* puiValue  );
M6EDLL_API int WINAPI RobotE_getModuleSerialNo( int iDeviceId, int iModuleId, unsigned long*  puiValue  );

/**********************************模块的复位、急停和清除错误***********************************/

M6EDLL_API int WINAPI RobotE_homeAll    ( int iDeviceId );
M6EDLL_API int WINAPI RobotE_resetAll   ( int iDeviceId );
M6EDLL_API int WINAPI RobotE_haltAll    ( int iDeviceId );
M6EDLL_API int WINAPI RobotE_homeModule ( int iDeviceId, int iModuleId );
M6EDLL_API int WINAPI RobotE_haltModule ( int iDeviceId, int iModuleId );
M6EDLL_API int WINAPI RobotE_resetModule( int iDeviceId, int iModuleId );

/***************************************模块参数的配置和获取************************************/

M6EDLL_API int WINAPI RobotE_setHomeVel( int iDeviceId,   int iModuleId,  float  fValue   );
M6EDLL_API int WINAPI RobotE_setRampVel( int iDeviceId,   int iModuleId,  float  fValue   );
M6EDLL_API int WINAPI RobotE_setRampAcc( int iDeviceId,   int iModuleId,  float  fValue   );
M6EDLL_API int WINAPI RobotE_setMinPos ( int iDeviceId,   int iModuleId,  float  fValue   );
M6EDLL_API int WINAPI RobotE_setMaxPos ( int iDeviceId,   int iModuleId,  float  fValue   );
M6EDLL_API int WINAPI RobotE_setMaxVel ( int iDeviceId,   int iModuleId,  float  fValue   ); 
M6EDLL_API int WINAPI RobotE_setMaxAcc ( int iDeviceId,   int iModuleId,  float  fValue   );
M6EDLL_API int WINAPI RobotE_setMaxCur ( int iDeviceId,   int iModuleId,  float  fValue   );
M6EDLL_API int WINAPI RobotE_getPos    ( int iDeviceId,   int iModuleId,  float* pfPos    );
M6EDLL_API int WINAPI RobotE_getVel    ( int iDeviceId,   int iModuleId,  float* pfVel    );
M6EDLL_API int WINAPI RobotE_getCur    ( int iDeviceId,   int iModuleId,  float* pfCur    );
M6EDLL_API int WINAPI RobotE_getHomeVel( int iDeviceId,   int iModuleId,  float* pValue   );
M6EDLL_API int WINAPI RobotE_getMinPos ( int iDeviceId,   int iModuleId,  float* pfValue  );
M6EDLL_API int WINAPI RobotE_getMaxPos ( int iDeviceId,   int iModuleId,  float* pfValue  );
M6EDLL_API int WINAPI RobotE_getMaxVel ( int iDeviceId,   int iModuleId,  float* pfValue  );
M6EDLL_API int WINAPI RobotE_getMaxAcc ( int iDeviceId,   int iModuleId,  float* pfValue  );
M6EDLL_API int WINAPI RobotE_getMaxCur ( int iDeviceId,   int iModuleId,  float* pfValue  );


M6EDLL_API int WINAPI RobotE_setHomeOffset ( int iDeviceId, int iModuleId, float fValue  );
M6EDLL_API int WINAPI RobotE_configFromFile( const char* acFileName                      );
M6EDLL_API int WINAPI RobotE_getHomeOffset ( int iDeviceId, int iModuleId, float* pValue );


/****************************************运动控制部分*****************************************/

M6EDLL_API int WINAPI RobotE_movePos    ( int iDeviceId, int iModuleId, float fPos               );
M6EDLL_API int WINAPI RobotE_moveVel    ( int iDeviceId, int iModuleId, float fVel               ); 
M6EDLL_API int WINAPI RobotE_movePosSet ( int iDeviceId, int iCount, PM6E_MOTIONDATA pMotionData );
M6EDLL_API int WINAPI RobotE_moveStepSet( int iDeviceId, int iCount, PM6E_MOTIONDATA pMotionData );
M6EDLL_API int WINAPI RobotE_moveStep   ( int iDeviceId, int iModuleId, float fPos, unsigned short uiTime );


/****************************************其它辅助功能函数*************************************/

M6EDLL_API int WINAPI RobotE_waitForHomeEnd     ( int iDeviceId, int iModuleId, unsigned long uiTime );
M6EDLL_API int WINAPI RobotE_waitForMotionEnd   ( int iDeviceId, int iModuleId, unsigned long uiTime );
M6EDLL_API int WINAPI RobotE_waitForHomeEndAll  ( int iDeviceId, unsigned long uiTime                );
M6EDLL_API int WINAPI RobotE_waitForMotionEndAll( int iDeviceId, unsigned long uiTime                );

#ifdef __cplusplus
	}
#endif

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -