OpenEL 3.0.0

openEL_motor.h
Go to the documentation of this file.
1
12 /*
13
14 Copyright (c) 2017,2018 Japan Embedded Systems Technology Association(JASA)
15 All rights reserved.
16
17 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
18
19 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
20 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
21 Neither the name of the Association nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
22
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #ifndef OPENEL_MOTOR_H_
27 #define OPENEL_MOTOR_H_
28
29 #include "openEL.h"
30
31 #define ELMOTOR_PROPERTY (0x0010)
32
33 #if 0
34 //#define EL_NXT_PHYSICAL_ID_MOTOR (0x00100000)
35
36 /* Control Mode */
37 #define ELMOTOR_CTL_NON (0)
38 #define ELMOTOR_CTL_TORQUE (1)
39 #define ELMOTOR_CTL_SPEED (2)
40 #define ELMOTOR_CTL_POSITION (3)
43 //i 後で整理
44 /* Return Value */
45 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
46 #define ELRETURN_OK (0)
47 #define ELRETURN_ERR_NC (-256 + 1)
48 #define ELRETURN_ERR_PORT (-256 + 2)
49 #define ELRETURN_ERR_PRM (-256 + 3)
50 #define ELRETURN_ERR_NM (-256 + 4)
54 /* Parameter ID */
55 #define ELMOTOR_PRM_SW_INT_FL (8)
56 #define ELMOTOR_PRM_SW_INC_ABS (16)
57 #define ELMOTOR_PRM_RESO_BASE (18)
58 #define ELMOTOR_PRM_N_MUL_GEAR (20)
59 #define ELMOTOR_PRM_N_DIV_GEAR (22)
60 #define ELMOTOR_PRM_ONE_TURN (24)
61 #define ELMOTOR_PRM_K_MOVE (28)
62 #define ELMOTOR_PRM_TORQUE_MAX_I32 (32)
63 #define ELMOTOR_PRM_TORQUE_MAX_F64 (36)
64 #define ELMOTOR_PRM_TORQUE_LIM (40)
65 #define ELMOTOR_PRM_TORQUE_LIM_STOP (41)
67 /* callback event ID */
68 #define ELMOTOR_EVENT_ARRIVE_POSITION (0)
69 #define ELMOTOR_EVENT_PASSAGE_POSITION (1)
70 #define ELMOTOR_EVENT_ARRIVE_SPEED (2)
71
76 typedef struct elMotorSigIn_st {
77 uint32_t _not_use0:8;
78 uint32_t _not_use1:8;
79 uint32_t _vender_specific:16;
80 } ELMOTOR_SIGIN_T;
81
86 typedef struct elMotorSigOut_st {
87 uint32_t alarm:1;
88 uint32_t warning:1;
89 uint32_t _not_use_0:6;
91 uint32_t inPos:1;
92 uint32_t inVel:1;
93 uint32_t trqP:1;
94 uint32_t trqN:1;
95 uint32_t _not_use_1:4;
97 uint32_t _vender_specific:16;
98 } ELMOTOR_SIGOUT_T;
99
104 typedef void (*ELMOTOR_P_FNC_CALLBACK)(uint32_t portID,uint32_t eventID);
106 #endif
107
112 typedef struct elMotorFncTblSt {
113 /* 0x00 */ enum ReturnCode (*pFncInit)();
114 /* 0x01 */ enum ReturnCode (*pFncReInit)();
115 /* 0x02 */ enum ReturnCode (*pFncFinalize)();
116 /* 0x03 */ enum ReturnCode (*pFncAddObserver)();
117 /* 0x04 */ enum ReturnCode (*pFncRemoveObserver)();
118 /* 0x05 */ enum ReturnCode (*pFncGetProperty)();
119 /* 0x06 */ enum ReturnCode (*pFncGetTime)();
120 /* 0x07 */ enum ReturnCode (*pFncDummy07)();
122 /* 0x08 */ enum ReturnCode (*pFncSetPosition)(HALCOMPONENT_T **halComponent, halfloat position);
123 /* 0x09 */ enum ReturnCode (*pFncGetPosition)(HALCOMPONENT_T **halComponent, halfloat **position);
124 /* 0x0A */ enum ReturnCode (*pFncDummy0A)();
125 /* 0x0B */ enum ReturnCode (*pFncDummy0B)();
126 /* 0x0C */ enum ReturnCode (*pFncDummy0C)();
127 /* 0x0D */ enum ReturnCode (*pFncDummy0D)();
128 /* 0x0E */ enum ReturnCode (*pFncDummy0E)();
129 /* 0x0F */ enum ReturnCode (*pFncDummy0F)();
131 /* 0x10 */ enum ReturnCode (*pFncDummy10)();
132 /* 0x11 */ enum ReturnCode (*pFncDummy11)();
133 /* 0x12 */ enum ReturnCode (*pFncDummy12)();
134 /* 0x13 */ enum ReturnCode (*pFncDummy13)();
135 /* 0x14 */ enum ReturnCode (*pFncDummy14)();
136 /* 0x15 */ enum ReturnCode (*pFncDummy15)();
137 /* 0x16 */ enum ReturnCode (*pFncDummy16)();
138 /* 0x17 */ enum ReturnCode (*pFncDummy17)();
140 /* 0x18 */ enum ReturnCode (*pFncDummy18)();
141 /* 0x19 */ enum ReturnCode (*pFncDummy19)();
142 /* 0x1A */ enum ReturnCode (*pFncDummy1A)();
143 /* 0x1B */ enum ReturnCode (*pFncDummy1B)();
144 /* 0x1C */ enum ReturnCode (*pFncDummy1C)();
145 /* 0x1D */ enum ReturnCode (*pFncDummy1D)();
146 /* 0x1E */ enum ReturnCode (*pFncDummy1E)();
147 /* 0x1F */ enum ReturnCode (*pFncDummy1F)();
148 } ELMOTOR_FNC_TBL_T;
149
150 #if 0
151 /*---------------------------------------------------------------------------*/
165 int32_t elMotorSetCtlMode(uint32_t portID,uint32_t mode);
166 /*---------------------------------------------------------------------------*/
180 int32_t elMotorGetCtlMode(uint32_t portID,uint32_t *pMode);
181 /*---------------------------------------------------------------------------*/
199 int32_t elMotorSetPosition_I32(uint32_t portID,int32_t position,int32_t speed,int32_t tmAcc);
200 /*---------------------------------------------------------------------------*/
218 int32_t elMotorSetPosition_F64(uint32_t portID,double position,double speed,double tmAcc);
219 /*---------------------------------------------------------------------------*/
235 int32_t elMotorSetSpeed_I32(uint32_t portID,int32_t speed,int32_t tmAcc);
236 /*---------------------------------------------------------------------------*/
252 /*---------------------------------------------------------------------------*/
253 int32_t elMotorSetSpeed_F64( uint32_t portID,double speed,double tmAcc);
267 int32_t elMotorSetTorque_I32(uint32_t portID,int32_t torque);
268 /*---------------------------------------------------------------------------*/
282 int32_t elMotorSetTorque_F64(uint32_t portID,double torque);
283 /*---------------------------------------------------------------------------*/
284 /* メモ
285 * 仕様書(Ver.1.0用)とヘッダーファイルが違っている
286 * 仕様書(Ver.1.0用)はVer.0.1で記載されています
287 */
303 int32_t elMotorSetBrake_I32(uint32_t portID,uint32_t ctlAftBrk,int32_t tmDec);
319 int32_t elMotorSetBrake_F64(uint32_t portID,uint32_t ctlAftBrk,double tmDec);
320 /*---------------------------------------------------------------------------*/
334 int32_t elMotorGetBrake(uint32_t portID,uint32_t *pFlagBrake);
348 int32_t elMotorPreSetPosition_I32(uint32_t portID,int32_t pos);
362 int32_t elMotorPreSetPosition_F64(uint32_t portID,double pos);
363 /*---------------------------------------------------------------------------*/
379 int32_t elMotorGetPosition_I32(uint32_t portID,uint32_t idx,int32_t *pPosition);
395 int32_t elMotorGetPosition_F64(uint32_t portID,uint32_t idx,double *pPosition);
396 /*---------------------------------------------------------------------------*/
412 int32_t elMotorGetSpeed_I32(uint32_t portID,int32_t idx,int32_t *pOutSpeed);
428 int32_t elMotorGetSpeed_F64(uint32_t portID,int32_t idx,double *pOutSpeed);
429 /*---------------------------------------------------------------------------*/
430
431 /*---------------------------------------------------------------------------*/
432 /* Ver.2.00 */
433 /*---------------------------------------------------------------------------*/
440 int32_t elMotorGoHome_I32(uint32_t portID,uint32_t idx,int32_t speed);
441 int32_t elMotorGoHome_F64(uint32_t portID,uint32_t idx,double speed);
442 /*---------------------------------------------------------------------------*/
449 int32_t elMotorSetCallBack_I32(uint32_t portID,uint32_t eventID,ELMOTOR_P_FNC_CALLBACK pFncCB,int32_t val);
450 int32_t elMotorSetCallBack_F64(uint32_t portID,uint32_t eventID,ELMOTOR_P_FNC_CALLBACK pFncCB,double val);
451 /*---------------------------------------------------------------------------*/
452
453 //i 後でopenEL.hに移動する
454 /*---------------------------------------------------------------------------*/
461 int32_t elMotorSetParam_U16(uint32_t portID,uint32_t prmID,uint16_t val);
462 int32_t elMotorSetParam_I16(uint32_t portID,uint32_t prmID,int16_t val);
463 int32_t elMotorSetParam_U32(uint32_t portID,uint32_t prmID,uint32_t val);
464 int32_t elMotorSetParam_I32(uint32_t portID,uint32_t prmID,uint32_t val);
465 int32_t elMotorSetParam_I64(uint32_t portID,uint32_t prmID,uint64_t val);
466 int32_t elMotorSetParam_U64(uint32_t portID,uint32_t prmID,uint64_t val);
467 int32_t elMotorSetParam_F32(uint32_t portID,uint32_t prmID,float val);
468 int32_t elMotorSetParam_F64(uint32_t portID,uint32_t prmID,double val);
469 /*---------------------------------------------------------------------------*/
476 int32_t elMotorGetParam_U16(uint32_t portID,uint32_t prmID,uint16_t *pOutVal);
477 int32_t elMotorGetParam_I16(uint32_t portID,uint32_t prmID,int16_t *pOutVal);
478 int32_t elMotorGetParam_U32(uint32_t portID,uint32_t prmID,uint32_t *pOutVal);
479 int32_t elMotorGetParam_I32(uint32_t portID,uint32_t prmID,int32_t *pOutVal);
480 int32_t elMotorGetParam_U64(uint32_t portID,uint32_t prmID,uint64_t *pOutVal);
481 int32_t elMotorGetParam_I64(uint32_t portID,uint32_t prmID,int64_t *pOutVal);
482 int32_t elMotorGetParam_F32(uint32_t portID,uint32_t prmID,float *pOutVal);
483 int32_t elMotorGetParam_F64(uint32_t portID,uint32_t prmID,double *pOutVal);
484 /*---------------------------------------------------------------------------*/
485 #endif
486
487 #endif /* OPENEL_MOTOR_H_ */
elMotorFncTblSt::pFncDummy14
enum ReturnCode(* pFncDummy14)()
Definition: openEL_motor.h:135
elMotorFncTblSt::pFncDummy1A
enum ReturnCode(* pFncDummy1A)()
Definition: openEL_motor.h:142
elMotorFncTblSt::pFncAddObserver
enum ReturnCode(* pFncAddObserver)()
Definition: openEL_motor.h:116
elMotorFncTblSt::pFncInit
enum ReturnCode(* pFncInit)()
Definition: openEL_motor.h:113
elMotorFncTblSt::pFncDummy1B
enum ReturnCode(* pFncDummy1B)()
Definition: openEL_motor.h:143
openEL.h
OpenEL Common Header File 3.0.0.
elMotorFncTblSt::pFncDummy1F
enum ReturnCode(* pFncDummy1F)()
Definition: openEL_motor.h:147
elMotorFncTblSt::pFncFinalize
enum ReturnCode(* pFncFinalize)()
Definition: openEL_motor.h:115
elMotorFncTblSt::pFncDummy10
enum ReturnCode(* pFncDummy10)()
Definition: openEL_motor.h:131
elMotorFncTblSt::pFncReInit
enum ReturnCode(* pFncReInit)()
Definition: openEL_motor.h:114
elMotorFncTblSt::pFncDummy19
enum ReturnCode(* pFncDummy19)()
Definition: openEL_motor.h:141
ReturnCode
ReturnCode
Definition: openEL.h:44
elMotorFncTblSt::pFncDummy16
enum ReturnCode(* pFncDummy16)()
Definition: openEL_motor.h:137
elMotorFncTblSt
Definition: openEL_motor.h:112
elMotorFncTblSt::pFncDummy17
enum ReturnCode(* pFncDummy17)()
Definition: openEL_motor.h:138
elMotorFncTblSt::pFncDummy07
enum ReturnCode(* pFncDummy07)()
Definition: openEL_motor.h:120
elMotorFncTblSt::pFncDummy0F
enum ReturnCode(* pFncDummy0F)()
Definition: openEL_motor.h:129
elMotorFncTblSt::pFncDummy1D
enum ReturnCode(* pFncDummy1D)()
Definition: openEL_motor.h:145
elMotorFncTblSt::pFncGetTime
enum ReturnCode(* pFncGetTime)()
Definition: openEL_motor.h:119
halfloat
float32_t halfloat
Definition: openEL.h:53
elMotorFncTblSt::pFncDummy0E
enum ReturnCode(* pFncDummy0E)()
Definition: openEL_motor.h:128
elMotorFncTblSt::pFncDummy1C
enum ReturnCode(* pFncDummy1C)()
Definition: openEL_motor.h:144
HalComponent
Definition: openEL.h:162
elMotorFncTblSt::pFncDummy0A
enum ReturnCode(* pFncDummy0A)()
Definition: openEL_motor.h:124
elMotorFncTblSt::pFncGetProperty
enum ReturnCode(* pFncGetProperty)()
Definition: openEL_motor.h:118
elMotorFncTblSt::pFncDummy0C
enum ReturnCode(* pFncDummy0C)()
Definition: openEL_motor.h:126
elMotorFncTblSt::pFncDummy1E
enum ReturnCode(* pFncDummy1E)()
Definition: openEL_motor.h:146
elMotorFncTblSt::pFncRemoveObserver
enum ReturnCode(* pFncRemoveObserver)()
Definition: openEL_motor.h:117
ELMOTOR_FNC_TBL_T
struct elMotorFncTblSt ELMOTOR_FNC_TBL_T
elMotorFncTblSt::pFncDummy12
enum ReturnCode(* pFncDummy12)()
Definition: openEL_motor.h:133
elMotorFncTblSt::pFncGetPosition
enum ReturnCode(* pFncGetPosition)(HALCOMPONENT_T **halComponent, halfloat **position)
Definition: openEL_motor.h:123
elMotorFncTblSt::pFncDummy13
enum ReturnCode(* pFncDummy13)()
Definition: openEL_motor.h:134
elMotorFncTblSt::pFncDummy15
enum ReturnCode(* pFncDummy15)()
Definition: openEL_motor.h:136
elMotorFncTblSt::pFncDummy0D
enum ReturnCode(* pFncDummy0D)()
Definition: openEL_motor.h:127
elMotorFncTblSt::pFncSetPosition
enum ReturnCode(* pFncSetPosition)(HALCOMPONENT_T **halComponent, halfloat position)
Definition: openEL_motor.h:122
elMotorFncTblSt::pFncDummy18
enum ReturnCode(* pFncDummy18)()
Definition: openEL_motor.h:140
elMotorFncTblSt::pFncDummy0B
enum ReturnCode(* pFncDummy0B)()
Definition: openEL_motor.h:125
elMotorFncTblSt::pFncDummy11
enum ReturnCode(* pFncDummy11)()
Definition: openEL_motor.h:132