nucho
/
RTno_MotorControl
RTno/RTno.h@1:7f0fc0d1f777, 2011-08-01 (annotated)
- Committer:
- nucho
- Date:
- Mon Aug 01 14:46:08 2011 +0000
- Revision:
- 1:7f0fc0d1f777
- Parent:
- 0:3c49891bc39d
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nucho | 0:3c49891bc39d | 1 | #ifndef RTNO_HEADER_INCLUDED |
nucho | 0:3c49891bc39d | 2 | #define RTNO_HEADER_INCLUDED |
nucho | 0:3c49891bc39d | 3 | |
nucho | 0:3c49891bc39d | 4 | /******************************************* |
nucho | 0:3c49891bc39d | 5 | * RTno.h |
nucho | 0:3c49891bc39d | 6 | * @author Yuki Suga |
nucho | 0:3c49891bc39d | 7 | * @copyright Yuki Suga (ysuga.net) Nov, 10th, 2010. |
nucho | 0:3c49891bc39d | 8 | * @license LGPLv3 |
nucho | 0:3c49891bc39d | 9 | *****************************************/ |
nucho | 0:3c49891bc39d | 10 | |
nucho | 0:3c49891bc39d | 11 | |
nucho | 0:3c49891bc39d | 12 | //#define BAUDRATE 19200 |
nucho | 0:3c49891bc39d | 13 | |
nucho | 0:3c49891bc39d | 14 | #define RTC_OK 0 |
nucho | 0:3c49891bc39d | 15 | #define RTC_ERROR -1 |
nucho | 0:3c49891bc39d | 16 | |
nucho | 0:3c49891bc39d | 17 | #include "BasicDataType.h" |
nucho | 0:3c49891bc39d | 18 | #include "InPort.h" |
nucho | 0:3c49891bc39d | 19 | #include "OutPort.h" |
nucho | 0:3c49891bc39d | 20 | |
nucho | 0:3c49891bc39d | 21 | |
nucho | 0:3c49891bc39d | 22 | extern "C" { |
nucho | 0:3c49891bc39d | 23 | void addInPort(InPortBase& inPort); |
nucho | 0:3c49891bc39d | 24 | void addOutPort(OutPortBase& outPort); |
nucho | 0:3c49891bc39d | 25 | } |
nucho | 0:3c49891bc39d | 26 | |
nucho | 0:3c49891bc39d | 27 | struct config_str { |
nucho | 0:3c49891bc39d | 28 | struct default_str { |
nucho | 0:3c49891bc39d | 29 | long baudrate; |
nucho | 0:3c49891bc39d | 30 | } _default; |
nucho | 0:3c49891bc39d | 31 | }; |
nucho | 0:3c49891bc39d | 32 | |
nucho | 0:3c49891bc39d | 33 | struct exec_cxt_str { |
nucho | 0:3c49891bc39d | 34 | struct periodic_str { |
nucho | 0:3c49891bc39d | 35 | long type; |
nucho | 0:3c49891bc39d | 36 | } periodic; |
nucho | 0:3c49891bc39d | 37 | }; |
nucho | 0:3c49891bc39d | 38 | |
nucho | 0:3c49891bc39d | 39 | #define ProxySynchronousExecutionContext 1 |
nucho | 0:3c49891bc39d | 40 | |
nucho | 0:3c49891bc39d | 41 | extern exec_cxt_str exec_cxt; |
nucho | 0:3c49891bc39d | 42 | |
nucho | 0:3c49891bc39d | 43 | extern config_str conf; |
nucho | 0:3c49891bc39d | 44 | |
nucho | 0:3c49891bc39d | 45 | |
nucho | 0:3c49891bc39d | 46 | extern "C" { |
nucho | 0:3c49891bc39d | 47 | void rtcconf(void); |
nucho | 0:3c49891bc39d | 48 | }; |
nucho | 0:3c49891bc39d | 49 | |
nucho | 0:3c49891bc39d | 50 | namespace RTno { |
nucho | 0:3c49891bc39d | 51 | extern "C" { |
nucho | 0:3c49891bc39d | 52 | // setup function is defined in RTno.cpp |
nucho | 0:3c49891bc39d | 53 | void setup(); |
nucho | 0:3c49891bc39d | 54 | |
nucho | 0:3c49891bc39d | 55 | // loop fuction is defined in RTno.cpp |
nucho | 0:3c49891bc39d | 56 | void loop(); |
nucho | 0:3c49891bc39d | 57 | |
nucho | 0:3c49891bc39d | 58 | // These call-back funcitons should be defined in user program code. |
nucho | 0:3c49891bc39d | 59 | // Use RTno_template.pde to create your own project. |
nucho | 0:3c49891bc39d | 60 | |
nucho | 0:3c49891bc39d | 61 | /** |
nucho | 0:3c49891bc39d | 62 | * onInitialize() |
nucho | 0:3c49891bc39d | 63 | * This function is called when RTno is initialized. |
nucho | 0:3c49891bc39d | 64 | * RTno is usually initialized when the RTno-proxy is launched. |
nucho | 0:3c49891bc39d | 65 | */ |
nucho | 0:3c49891bc39d | 66 | int onInitialize(); |
nucho | 0:3c49891bc39d | 67 | |
nucho | 0:3c49891bc39d | 68 | /** |
nucho | 0:3c49891bc39d | 69 | * onActivated() |
nucho | 0:3c49891bc39d | 70 | * This function is called when RTno is activated. |
nucho | 0:3c49891bc39d | 71 | * RTno is usually activated by RT System Editor or other tools for OpenRTM-aist. |
nucho | 0:3c49891bc39d | 72 | */ |
nucho | 0:3c49891bc39d | 73 | int onActivated(); |
nucho | 0:3c49891bc39d | 74 | |
nucho | 0:3c49891bc39d | 75 | /** |
nucho | 0:3c49891bc39d | 76 | * onExecute() |
nucho | 0:3c49891bc39d | 77 | * This function is periodically called when the RTno-proxy is active. |
nucho | 0:3c49891bc39d | 78 | */ |
nucho | 0:3c49891bc39d | 79 | int onExecute(); |
nucho | 0:3c49891bc39d | 80 | |
nucho | 0:3c49891bc39d | 81 | /** |
nucho | 0:3c49891bc39d | 82 | * onDeactivated() |
nucho | 0:3c49891bc39d | 83 | * This function is called when RTno is deactivated. |
nucho | 0:3c49891bc39d | 84 | * RTno is usually deactivated by RT System Editor or other tools for OpenRTM-aist. |
nucho | 0:3c49891bc39d | 85 | */ |
nucho | 0:3c49891bc39d | 86 | int onDeactivated(); |
nucho | 0:3c49891bc39d | 87 | |
nucho | 0:3c49891bc39d | 88 | /** |
nucho | 0:3c49891bc39d | 89 | * onError |
nucho | 0:3c49891bc39d | 90 | * This function is called when RTno is error. |
nucho | 0:3c49891bc39d | 91 | * [DANGEROUS] This function is periodically called in very short interval. |
nucho | 0:3c49891bc39d | 92 | */ |
nucho | 0:3c49891bc39d | 93 | int onError(); |
nucho | 0:3c49891bc39d | 94 | |
nucho | 0:3c49891bc39d | 95 | /** |
nucho | 0:3c49891bc39d | 96 | * onReset |
nucho | 0:3c49891bc39d | 97 | * This function is called when RTno is reset. |
nucho | 0:3c49891bc39d | 98 | * RTno is usually reset by RT System Editor or other tools for OpenRTM-aist. |
nucho | 0:3c49891bc39d | 99 | */ |
nucho | 0:3c49891bc39d | 100 | int onReset(); |
nucho | 0:3c49891bc39d | 101 | };// extern "C" |
nucho | 0:3c49891bc39d | 102 | }; |
nucho | 0:3c49891bc39d | 103 | |
nucho | 0:3c49891bc39d | 104 | |
nucho | 0:3c49891bc39d | 105 | #endif |
nucho | 0:3c49891bc39d | 106 |