ControlMainでの変更に対応して、新しくレポジトリを作りました
Dependencies: Control_Yokutan_CANver1 XBusServo mbed mbed-rtos
Fork of ControlYokutan2017 by
Diff: main.cpp
- Branch:
- XBus???
- Revision:
- 38:b492990e2b56
- Parent:
- 37:1f71ca1e5dd1
- Child:
- 39:c6036315831a
diff -r 1f71ca1e5dd1 -r b492990e2b56 main.cpp --- a/main.cpp Sat Mar 11 16:22:16 2017 +0000 +++ b/main.cpp Sat Mar 11 16:47:45 2017 +0000 @@ -12,23 +12,17 @@ #define SEND_DATAS_LOOP_TIME 0.1 #define RECEIVE_DATAS_LOOP_TIME 0.1 -#define ERURON_MOVE_DEG_INI_R 1.0 -#define DRUG_MOVE_DEG_INI_R 0.3 +#define ERURON_MOVE_DEG_INI_R 0.5 +#define DRUG_MOVE_DEG_INI_R 0.34 #define ERURON_TRIM_INI_R 0 -#define DRUG_TRIM_INI_R 0.5 +#define DRUG_TRIM_INI_R 0.65 -#define ERURON_MOVE_DEG_INI_L 1.0 -#define DRUG_MOVE_DEG_INI_L 0.3 +#define ERURON_MOVE_DEG_INI_L 0.5 +#define DRUG_MOVE_DEG_INI_L 0.34 #define ERURON_TRIM_INI_L 0 -#define DRUG_TRIM_INI_L 0.5 +#define DRUG_TRIM_INI_L 0.65 -/* -#define kMaxServoNum 1 // 1 - 50 -#define kMaxServoPause (sizeof(motionData) / sizeof(pauseRec)) -#define kMotionInterval 10 // flame / sec -#define kMotionMinMark 0x1249 -#define kMotionEndMark 0xED86 - +/*ドラッグラダー 初期値 0.65 最大角0.99 */ @@ -76,7 +70,6 @@ void receiveDatas(); void WriteServo(); -//XBusServo gXBus(p13, NC, NC, kMaxServoNum); Ticker gTimer; bool servoInit() @@ -106,24 +99,6 @@ return true; } -/* -XBusError initXBus() -{ - XBusError result; - result = gXBus.start(); - if (result != kXBusError_NoError) { - gXBus.stop(); - return result; - } - result = gXBus.addServo(servoChannel, kXbusServoNeutral); - if (result != kXBusError_NoError) { - gXBus.stop(); - return result; - } - return kXBusError_NoError; -} -*/ - void init() { if(!LRstatePin) { @@ -177,7 +152,7 @@ double calcPulse(float deg) { - return (0.0006+(deg)*(0.00235-0.00045)); + return (0.0006+(deg)*(0.00220-0.00045)); /* int start=510, end=2390; while(1) { @@ -196,9 +171,9 @@ void WriteServo() { - drugServo.pulsewidth(calcPulse( drugTrim + drugMoveDeg *(float)controlValues[sizeof(float)])); - eruronServo.pulsewidth(calcPulse( eruronTrim + eruronMoveDeg * SampleFloat((eruronfloat / 2.0)))); - pc.printf("drValue::%f ef::%f\n\r",drugTrim + drugMoveDeg *(float)controlValues[sizeof(float)] / 2.0,SampleFloat((eruronfloat / 2.0))); + drugServo.pulsewidth(calcPulse( drugTrim + drugMoveDeg *(float)controlValues[sizeof(float)] / 2.0)); + eruronServo.pulsewidth(calcPulse( eruronTrim + eruronMoveDeg * SampleFloat((eruronfloat)))); + pc.printf("drValue::%f ef::%f\n\r",drugTrim + drugMoveDeg *(float)controlValues[sizeof(float)],SampleFloat((eruronfloat))); // pc.printf("raw:%f sampled:%f\n\r",eruronfloat /3.0,SampleFloat(eruronfloat / 3.0)); }