[go: up one dir, main page]

JP5861622B2 - Coaxial two-wheel moving body and control method thereof - Google Patents

Coaxial two-wheel moving body and control method thereof Download PDF

Info

Publication number
JP5861622B2
JP5861622B2 JP2012261135A JP2012261135A JP5861622B2 JP 5861622 B2 JP5861622 B2 JP 5861622B2 JP 2012261135 A JP2012261135 A JP 2012261135A JP 2012261135 A JP2012261135 A JP 2012261135A JP 5861622 B2 JP5861622 B2 JP 5861622B2
Authority
JP
Japan
Prior art keywords
time
timer
cpu
counter
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2012261135A
Other languages
Japanese (ja)
Other versions
JP2014104928A (en
Inventor
平 哲也
哲也 平
浩司 尾藤
浩司 尾藤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Toyota Motor Corp
Original Assignee
Toyota Motor Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Toyota Motor Corp filed Critical Toyota Motor Corp
Priority to JP2012261135A priority Critical patent/JP5861622B2/en
Publication of JP2014104928A publication Critical patent/JP2014104928A/en
Application granted granted Critical
Publication of JP5861622B2 publication Critical patent/JP5861622B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Motorcycle And Bicycle Frame (AREA)

Description

本発明は、同軸二輪移動体及びその制御方法に関し、特に、複数のCPUで同軸二輪移動体を制御する技術に関する。   The present invention relates to a coaxial two-wheel moving body and a control method therefor, and more particularly to a technique for controlling a coaxial two-wheel moving body with a plurality of CPUs.

特許文献1〜3には、多重化されたCPUによって制御される車両が開示されている。例えば、特許文献1に開示の個人輸送車は、AグループとBグループの冗長コンポーネントのそれぞれに属するAプロセッサとBプロセッサによって、2つの車輪のそれぞれと連結された2つのモータを制御する。   Patent Documents 1 to 3 disclose vehicles controlled by multiplexed CPUs. For example, the personal transportation vehicle disclosed in Patent Document 1 controls two motors connected to each of two wheels by an A processor and a B processor that belong to redundant components of group A and group B, respectively.

しかしながら、多重化されたCPUのそれぞれで実行する処理のタイミングは、それぞれのCPUに供給されるクロックに依存する。したがって、別々のクロックで動作するCPUは、クロックの精度及びクロックの供給開始タイミングのズレ等によって、それぞれのCPUで実行する処理を完全に同期することは困難である。同軸二輪移動体の安定性を向上する上で、複数のCPUのそれぞれで実行される、同軸二輪移動体の制御に関する処理を同期して実行することは非常に重要である。   However, the timing of processing executed by each multiplexed CPU depends on the clock supplied to each CPU. Therefore, it is difficult for CPUs operating with different clocks to completely synchronize the processes executed by the respective CPUs due to the accuracy of the clock and the deviation of the clock supply start timing. In order to improve the stability of the coaxial two-wheel moving body, it is very important to execute the processing related to the control of the coaxial two-wheel moving body, which is executed by each of the plurality of CPUs, in synchronization.

米国特許出願公開第2003/0146025号公報US Patent Application Publication No. 2003/0146025 国際公開第2011/089656号International Publication No. 2011/088966 特開2009−187561号公報JP 2009-187561 A

本発明は、上述した知見に基づいてなされたものであって、複数のCPUのそれぞれで実行される、同軸二輪移動体の制御に関する処理の同期の精度を向上することができる同軸二輪移動体及びその制御方法を提供することを目的とする。   The present invention has been made on the basis of the above-described knowledge, and is a coaxial two-wheel moving body capable of improving the accuracy of synchronization of processing related to the control of the coaxial two-wheel moving body executed by each of a plurality of CPUs. An object is to provide a control method thereof.

本発明の第1の態様にかかる同軸二輪移動体は、制御に応じて移動する同軸二輪移動体であって、第1のクロック信号を生成する第1のクロック生成部と、第2のクロック信号を生成する第2のクロック生成部と、前記第1のクロック信号に基づいて時間を計測する第1のタイマと、前記第2のクロック信号に基づいて時間を計測する第2のタイマと、前記第1のタイマが計測する時間に基づいて、前記同軸二輪移動体を制御する第1のCPUと、前記第2のタイマが計測する時間に基づいて、前記同軸二輪移動体を制御する第2のCPUと、を備え、前記第1のCPUは、第1の所定事象の検出時における前記第1のタイマの時間と、前記第1の所定事象よりも後に発生する第2の所定事象の検出時における前記第1のタイマの時間とに関する時間情報を前記第2のCPUに送信し、前記第2のCPUは、前記第1のCPUから送信された時間情報から得られる前記第1の所定事象の検出時から前記第2の所定事象の検出時までの前記第1のタイマにおける経過時間と、前記第1の所定事象の検出時から前記第2の所定事象の検出時までの前記第2のタイマにおける経過時間との比率に基づいて、前記第2のタイマが計測する時間を前記第1のタイマで計測した場合における時間に補正するものである。   The coaxial two-wheel moving body according to the first aspect of the present invention is a coaxial two-wheel moving body that moves according to control, and includes a first clock generation unit that generates a first clock signal, and a second clock signal. A second clock generation unit that generates a first timer that measures time based on the first clock signal, a second timer that measures time based on the second clock signal, A first CPU that controls the coaxial two-wheel moving body based on a time measured by the first timer, and a second CPU that controls the coaxial two-wheel moving body based on the time measured by the second timer. And the first CPU detects the time of the first timer at the time of detection of the first predetermined event and the time of detection of the second predetermined event that occurs after the first predetermined event. And the time of the first timer in Time information is transmitted to the second CPU, and the second CPU detects the first predetermined event from the time of detection of the first predetermined event obtained from the time information transmitted from the first CPU. Based on the ratio of the elapsed time in the first timer until the time of detection of the first timer and the elapsed time in the second timer from the time of detection of the first predetermined event to the time of detection of the second predetermined event The time measured by the second timer is corrected to the time when measured by the first timer.

本発明の第2の態様にかかる制御方法は、第1のクロック信号によって第1のタイマが計測する時間に基づいて動作する第1のCPUと、第2のクロック信号によって第2のタイマが計測する時間に基づいて動作する第2のCPUとよって同軸二輪移動体を制御する制御方法あって、前記第1のCPUが、第1の所定事象の検出時における前記第1のタイマの時間と、前記第1の所定事象よりも後に発生する第2の所定事象の検出時における前記第1のタイマの時間とに関する時間情報を前記第2のCPUに送信するステップと、前記第2のCPUが、前記第1のCPUから送信された時間情報から得られる前記第1の所定事象の検出時から前記第2の所定事象の検出時までの前記第1のタイマにおける経過時間と、前記第1の所定事象の検出時から前記第2の所定事象の検出時までの前記第2のタイマにおける経過時間との比率に基づいて、前記第2のタイマが計測する時間を前記第1のタイマで計測した場合における時間に補正するステップと、を備えたものである。   The control method according to the second aspect of the present invention includes a first CPU that operates based on a time measured by a first timer by a first clock signal, and a second timer that measures by a second clock signal. A control method for controlling the coaxial two-wheeled vehicle by a second CPU that operates based on a time for the first timer to detect the first predetermined time when the first CPU detects a first predetermined event; Transmitting to the second CPU time information regarding the time of the first timer at the time of detection of a second predetermined event that occurs after the first predetermined event; and the second CPU, The elapsed time in the first timer from the time of detection of the first predetermined event to the time of detection of the second predetermined event obtained from the time information transmitted from the first CPU, and the first predetermined Event detection The time measured by the second timer based on the ratio with the elapsed time in the second timer from the time until the detection of the second predetermined event to the time when the first timer measures the time And a step of correcting.

上述した本発明の各態様によれば、複数のCPUのそれぞれで実行される、同軸二輪移動体の制御に関する処理の同期の精度を向上することができる同軸二輪移動体及びその制御方法を提供することができる。   According to each aspect of the present invention described above, a coaxial two-wheel moving body that can be improved in synchronization accuracy of processing related to the control of the coaxial two-wheel moving body, which is executed by each of a plurality of CPUs, and a control method therefor are provided. be able to.

実施の形態に係る倒立二輪車の概要構成を示す図である。1 is a diagram showing a schematic configuration of an inverted motorcycle according to an embodiment. 実施の形態に係る制御装置の構成を示すブロック図である。It is a block diagram which shows the structure of the control apparatus which concerns on embodiment. 実施の形態に係るマイコンの詳細構成を示す図である。It is a figure which shows the detailed structure of the microcomputer which concerns on embodiment. クロック信号のズレを説明するための図である。It is a figure for demonstrating the shift | offset | difference of a clock signal. 実施の形態に係る時間同期方法の概要を説明するための図である。It is a figure for demonstrating the outline | summary of the time synchronization method which concerns on embodiment. 実施の形態に係る倒立二輪車の時間同期処理を示すフローチャートである。It is a flowchart which shows the time synchronization process of the inverted motorcycle which concerns on embodiment. 実施の形態に係る時間同期方法の詳細を説明するための図である。It is a figure for demonstrating the detail of the time synchronization method which concerns on embodiment. 実施の形態の効果を説明するための図である。It is a figure for demonstrating the effect of embodiment. 実施の形態の効果を説明するための図である。It is a figure for demonstrating the effect of embodiment. 傾き補正における問題点を説明するための図である。It is a figure for demonstrating the problem in inclination correction. 実施の形態に係る傾き補正の微調整を示す図である。It is a figure which shows the fine adjustment of the inclination correction which concerns on embodiment.

以下に図面を参照しながら、本発明の好適な実施の形態について説明する。以下の実施の形態に示す具体的な数値等は、発明の理解を容易とするための例示にすぎず、特に断る場合を除き、それに限定されるものではない。また、以下の記載及び図面では、説明の明確化のため、当業者にとって自明な事項等については、適宜、省略及び簡略化がなされている。   Hereinafter, preferred embodiments of the present invention will be described with reference to the drawings. Specific numerical values and the like shown in the following embodiments are merely examples for facilitating understanding of the invention, and are not limited thereto unless otherwise specified. In the following description and drawings, matters obvious to those skilled in the art are omitted or simplified as appropriate for the sake of clarity.

<発明の実施の形態>
図1を参照して、実施の形態にかかる倒立二輪車1の概要構成について説明する。図1は、実施の形態にかかる倒立二輪車1の概要構成を示す図である。
<Embodiment of the Invention>
A schematic configuration of an inverted motorcycle 1 according to an embodiment will be described with reference to FIG. FIG. 1 is a diagram illustrating a schematic configuration of an inverted motorcycle 1 according to an embodiment.

倒立二輪車1は、ハンドル4を把持してステップカバー3に搭乗した搭乗者(ユーザ)が、倒立二輪車1の前後方向に荷重を作用させた際における、前後方向への倒立二輪車1の姿勢角(ピッチ角)をセンサを利用して検出し、この検出結果に基づいて、倒立二輪車1の倒立状態を維持するように左右の車輪2を駆動するモータを制御する。すなわち、倒立二輪車1は、ステップカバー3に搭乗した搭乗者が前方に荷重を作用させて倒立二輪車1を前方に傾斜させると、倒立二輪車1の倒立状態を維持するように前方に加速し、搭乗者が後方に荷重を作用させて倒立二輪車1を後方に傾斜させると、倒立二輪車1の倒立状態を維持するように後方に加速するように、左右の車輪2を駆動するモータを制御する。倒立二輪車1は、制御の安定性を確保するために、モータを制御する制御系が2重化されている。   The inverted motorcycle 1 is configured such that a passenger (user) who holds the handle 4 and rides on the step cover 3 applies a load in the front-rear direction of the inverted motorcycle 1 and the posture angle of the inverted motorcycle 1 in the front-rear direction ( The pitch angle is detected using a sensor, and the motors that drive the left and right wheels 2 are controlled so as to maintain the inverted state of the inverted motorcycle 1 based on the detection result. That is, the inverted motorcycle 1 accelerates forward so that the inverted motorcycle 1 maintains the inverted state when the passenger who has boarded the step cover 3 applies a load forward and tilts the inverted motorcycle 1 forward. When a person applies a load rearward to tilt the inverted motorcycle 1 backward, the motors that drive the left and right wheels 2 are controlled so as to accelerate backward so as to maintain the inverted motorcycle 1 in an inverted state. In the inverted two-wheeled vehicle 1, a control system for controlling the motor is duplicated in order to ensure control stability.

また、倒立二輪車1は、ユーザによる倒立二輪車1の牽引を容易にするために、上記制御を行う乗車モードから牽引モードへの切り替えが可能となっている。倒立二輪車1は、走行停止して搭乗者が降車した後に、倒立二輪車1に備え付けられた牽引モード切り替えボタン(図示せず)がユーザから押下されたときに、牽引モードに切り替わる。牽引モード時には、倒立二輪車1は、ユーザがハンドル4を把持して倒立二輪車1を前方に傾斜させると、前方に加速し、ユーザがハンドル4を把持して倒立二輪車1を後方に傾斜させると、後方に加速するように、左右の車輪2を駆動するモータを制御する。すなわち、前後方向への倒立二輪車1の姿勢角(ピッチ角)をセンサを利用して検出し、この検出結果に基づいて、左右の車輪2を駆動するモータを制御する点は、乗車モードと同様である。   Further, the inverted motorcycle 1 can be switched from the riding mode in which the above control is performed to the towing mode in order to facilitate the towing of the inverted motorcycle 1 by the user. The inverted motorcycle 1 is switched to the traction mode when the user presses a traction mode switching button (not shown) provided on the inverted motorcycle 1 after the traveling is stopped and the passenger gets off the vehicle. In the traction mode, the inverted motorcycle 1 accelerates forward when the user grips the handle 4 and tilts the inverted motorcycle 1 forward, and when the user grips the handle 4 and tilts the inverted motorcycle 1 backward, The motor which drives the left and right wheels 2 is controlled so as to accelerate backward. That is, the attitude angle (pitch angle) of the inverted two-wheeled vehicle 1 in the front-rear direction is detected using a sensor, and the motor for driving the left and right wheels 2 is controlled based on the detection result, as in the riding mode. It is.

しかし、牽引モードでは、あまり倒立状態を維持しようとすると、かえってユーザが倒立二輪車1を牽引しづらくなってしまう。そのため、倒立二輪車1は、乗車モードにおいて、ある姿勢角に傾斜した場合よりも、牽引モードにおいて、それと同じ姿勢角に傾斜した場合の方が加速度が低くなるように、左右の車輪2を駆動するモータを制御する。   However, in the traction mode, if the inverted state is maintained too much, the user hardly pulls the inverted motorcycle 1. Therefore, the inverted motorcycle 1 drives the left and right wheels 2 so that the acceleration is lower when tilted to the same posture angle in the traction mode than when tilted to a certain posture angle in the riding mode. Control the motor.

なお、これらのモータの制御は、倒立二輪車1に搭載された制御装置10によって行われる。   The control of these motors is performed by the control device 10 mounted on the inverted motorcycle 1.

続いて、図2を参照して、実施の形態にかかる制御装置10の構成について説明する。図2を参照して、実施の形態にかかる制御装置10の構成を示すブロック図である。   Then, with reference to FIG. 2, the structure of the control apparatus 10 concerning Embodiment is demonstrated. With reference to FIG. 2, it is a block diagram which shows the structure of the control apparatus 10 concerning Embodiment.

制御装置10は、マイクロコントローラ11、12(以下、「マイコン」とも呼ぶ)、インバータ13〜16、モータ17、18、回転角センサ19〜22、及びジャイロセンサセンサ23、24、クロック生成回路25、26、及びステップスイッチ(以下、「ステップSW」とも呼ぶ)27、28を有する。   The control device 10 includes microcontrollers 11 and 12 (hereinafter also referred to as “microcomputers”), inverters 13 to 16, motors 17 and 18, rotation angle sensors 19 to 22, gyro sensor sensors 23 and 24, a clock generation circuit 25, 26, and step switches (hereinafter also referred to as “step SW”) 27 and 28.

制御装置10は、倒立二輪車1の制御の安定性を確保するために、その制御系を、0系の制御系と1系の制御系とに二重化させた二重系システムとなっている。0系の制御系は、マイコン11、インバータ13、14、回転角センサ19、20、ジャイロセンサ23、及びクロック生成回路25を含む。1系の制御系は、マイコン12、インバータ15、16、回転角センサ21、22、ジャイロセンサ24、及びクロック生成回路26を含む。   The control device 10 is a dual system in which the control system is duplicated into a 0-system control system and a 1-system control system in order to ensure the stability of the control of the inverted motorcycle 1. The 0-system control system includes a microcomputer 11, inverters 13 and 14, rotation angle sensors 19 and 20, a gyro sensor 23, and a clock generation circuit 25. The 1-system control system includes a microcomputer 12, inverters 15 and 16, rotation angle sensors 21 and 22, a gyro sensor 24, and a clock generation circuit 26.

マイコン11、12のそれぞれは、ジャイロセンサセンサ23、24のそれぞれから出力される角速度信号に基づいて、上述したように、倒立二輪車1の倒立状態を維持するようにモータ17、18を制御するECU(Electronic Control Unit)である。マイコン11、12のそれぞれは、CPU(Central Processing Unit)及び記憶部を有し、記憶部に格納されたプログラムを実行することによって、本実施の形態におけるマイコン11、12のそれぞれとしての処理を実行する。すなわち、マイコン11、12のそれぞれの記憶部に格納されるプログラムは、本実施の形態におけるマイコン11、12のそれぞれにおける処理を、CPUに実行させるためのコードを含む。なお、記憶部は、例えば、このプログラムや、CPUにおける処理に利用される各種情報を格納することができる任意の記憶装置を含んで構成される。記憶装置は、例えば、メモリ等である。   Each of the microcomputers 11 and 12 is an ECU that controls the motors 17 and 18 to maintain the inverted state of the inverted motorcycle 1 as described above based on the angular velocity signals output from the gyro sensor sensors 23 and 24, respectively. (Electronic Control Unit). Each of the microcomputers 11 and 12 has a CPU (Central Processing Unit) and a storage unit, and executes processing as each of the microcomputers 11 and 12 in the present embodiment by executing a program stored in the storage unit. To do. That is, the program stored in the storage unit of each of the microcomputers 11 and 12 includes a code for causing the CPU to execute processing in each of the microcomputers 11 and 12 in the present embodiment. The storage unit includes, for example, an arbitrary storage device that can store the program and various types of information used for processing in the CPU. The storage device is, for example, a memory.

マイコン11は、モータ17を制御する指令値をインバータ13に出力する。また、マイコン11は、モータ18を制御する指令値をインバータ14に出力する。マイコン12は、モータ17を制御する指令値をインバータ15に出力する。また、マイコン12は、モータ18を制御する指令値をインバータ16に出力する。具体的には、マイコン11、12のそれぞれは、ジャイロセンサ23、24のそれぞれから出力される角速度信号が示す倒立二輪車1のピッチ軸周りの角速度(ピッチ角速度)を積分することで倒立二輪車1の前後方向の姿勢角(ピッチ角)を算出し、算出した姿勢角に基づいて倒立二輪車1の倒立状態を維持するようにモータ17、18を制御する指令値を生成する。   The microcomputer 11 outputs a command value for controlling the motor 17 to the inverter 13. Further, the microcomputer 11 outputs a command value for controlling the motor 18 to the inverter 14. The microcomputer 12 outputs a command value for controlling the motor 17 to the inverter 15. Further, the microcomputer 12 outputs a command value for controlling the motor 18 to the inverter 16. Specifically, each of the microcomputers 11 and 12 integrates angular velocities (pitch angular velocities) around the pitch axis of the inverted motorcycle 1 indicated by the angular velocity signals output from the gyro sensors 23 and 24, respectively. A posture angle (pitch angle) in the front-rear direction is calculated, and a command value for controlling the motors 17 and 18 is generated so as to maintain the inverted state of the inverted motorcycle 1 based on the calculated posture angle.

ここで、制御装置10は、ジャイロセンサ23、24に代えて、倒立二輪車1の前後方向の姿勢角(ピッチ角)を検出し、検出した姿勢角を示す姿勢角信号をマイコン11、12のそれぞれ出力する姿勢角センサを有するようにしてもよい。姿勢角センサは、例えば、加速度センサ及びジャイロセンサによって、倒立二輪車1の姿勢角を検出するように構成される。そして、マイコン11、12のそれぞれは、姿勢角センサから出力された姿勢角信号が示す姿勢角に基づいて、倒立状態を維持するようにモータ17、18を制御する指令値を生成するようにしてもよい。   Here, the control device 10 detects the posture angle (pitch angle) in the front-rear direction of the inverted two-wheeled vehicle 1 instead of the gyro sensors 23 and 24, and sends posture angle signals indicating the detected posture angles to the microcomputers 11 and 12, respectively. You may make it have the attitude | position angle sensor to output. The posture angle sensor is configured to detect the posture angle of the inverted motorcycle 1 by, for example, an acceleration sensor and a gyro sensor. Each of the microcomputers 11 and 12 generates a command value for controlling the motors 17 and 18 so as to maintain the inverted state based on the posture angle indicated by the posture angle signal output from the posture angle sensor. Also good.

また、マイコン11、12のそれぞれは、回転角センサ19、21のそれぞれから出力される、モータ17の回転角を示す回転角信号に基づいて、モータ17をフィードバック制御するように、インバータ13、15のそれぞれに対する指令値を生成する。また、マイコン11、12のそれぞれは、回転角センサ20、22のそれぞれから出力される、モータ18の回転角を示す回転角信号に基づいて、モータ18をフィードバック制御するように、インバータ14、16のそれぞれに対する指令値を生成する。   Each of the microcomputers 11 and 12 includes inverters 13 and 15 so as to feedback-control the motor 17 on the basis of a rotation angle signal output from each of the rotation angle sensors 19 and 21 and indicating the rotation angle of the motor 17. Generate command values for each of. Each of the microcomputers 11 and 12 includes inverters 14 and 16 so as to feedback-control the motor 18 based on a rotation angle signal indicating the rotation angle of the motor 18 output from each of the rotation angle sensors 20 and 22. Generate command values for each of.

インバータ13は、マイコン11から出力された指令値に基づいて、PWM(Pulse Width Modulation)制御を行うことで、モータ17を駆動する駆動電流を生成してモータ17に供給する。インバータ14は、マイコン11から出力された指令値に基づいて、PWM制御を行うことで、モータ18を駆動する駆動電流を生成してモータ18に供給する。インバータ15は、マイコン12から出力された指令値に基づいて、PWM制御を行うことで、モータ17を駆動する駆動電流を生成してモータ17に供給する。インバータ16は、マイコン12から出力された指令値に基づいて、PWM制御を行うことで、モータ18を駆動する駆動電流を生成してモータ18に供給する。   The inverter 13 performs PWM (Pulse Width Modulation) control based on the command value output from the microcomputer 11, thereby generating a drive current for driving the motor 17 and supplying the drive current to the motor 17. The inverter 14 performs PWM control based on the command value output from the microcomputer 11, thereby generating a drive current for driving the motor 18 and supplying the drive current to the motor 18. The inverter 15 performs a PWM control based on the command value output from the microcomputer 12, thereby generating a drive current for driving the motor 17 and supplying the drive current to the motor 17. The inverter 16 performs a PWM control based on the command value output from the microcomputer 12, thereby generating a drive current for driving the motor 18 and supplying the drive current to the motor 18.

モータ17、18のそれぞれは、二重巻線のモータである。モータ17は、インバータ13から供給される駆動電流と、インバータ15から供給される駆動電流とに基づいて駆動される。モータ17を駆動することによって、倒立二輪車1の左側の車輪2が回転する。モータ18は、インバータ14から供給される駆動電流と、インバータ16から供給される駆動電流とに基づいて駆動される。モータ18を駆動することによって、倒立二輪車1の右側の車輪2が回転する。   Each of the motors 17 and 18 is a double winding motor. The motor 17 is driven based on the drive current supplied from the inverter 13 and the drive current supplied from the inverter 15. By driving the motor 17, the left wheel 2 of the inverted motorcycle 1 rotates. The motor 18 is driven based on the drive current supplied from the inverter 14 and the drive current supplied from the inverter 16. By driving the motor 18, the right wheel 2 of the inverted motorcycle 1 rotates.

回転角センサ19は、モータ17の回転角を検出し、検出した回転角を示す回転角信号を生成してマイコン11に出力する。回転角センサ20は、モータ18の回転角を検出し、検出した回転角を示す回転角信号を生成してマイコン11に出力する。回転角センサ21は、モータ17の回転角を検出し、検出した回転角を示す回転角信号を生成してマイコン12に出力する。回転角センサ22は、モータ18の回転角を検出し、検出した回転角を示す回転角信号を生成してマイコン12に出力する。   The rotation angle sensor 19 detects the rotation angle of the motor 17, generates a rotation angle signal indicating the detected rotation angle, and outputs the rotation angle signal to the microcomputer 11. The rotation angle sensor 20 detects the rotation angle of the motor 18, generates a rotation angle signal indicating the detected rotation angle, and outputs the rotation angle signal to the microcomputer 11. The rotation angle sensor 21 detects the rotation angle of the motor 17, generates a rotation angle signal indicating the detected rotation angle, and outputs the rotation angle signal to the microcomputer 12. The rotation angle sensor 22 detects the rotation angle of the motor 18, generates a rotation angle signal indicating the detected rotation angle, and outputs the rotation angle signal to the microcomputer 12.

ジャイロセンサ23、24のそれぞれは、搭乗者がステップカバー3に対して、倒立二輪車1の前後方向に荷重を作用させた際における、倒立二輪車1の前後方向に対する角速度(ピッチ軸周りの角速度、ピッチ角速度)を検出し、検出した角速度を示す角速度信号をマイコン11、12のそれぞれに出力する。   Each of the gyro sensors 23 and 24 has an angular velocity (an angular velocity around the pitch axis, a pitch when the passenger applies a load to the step cover 3 in the front-rear direction of the inverted motorcycle 1 with respect to the front-rear direction of the inverted motorcycle 1. Angular velocity) is detected, and angular velocity signals indicating the detected angular velocities are output to the microcomputers 11 and 12, respectively.

クロック生成回路(クロック生成部)25、26のそれぞれは、クロック信号を生成して、マイコン11、12のそれぞれに供給する。マイコン11、12のそれぞれは、クロック生成回路25、26のそれぞれから供給されたクロック信号に基づいたタイミングで各種処理を実行する。   Each of the clock generation circuits (clock generation units) 25 and 26 generates a clock signal and supplies it to each of the microcomputers 11 and 12. Each of the microcomputers 11 and 12 executes various processes at timings based on clock signals supplied from the clock generation circuits 25 and 26, respectively.

ステップSW(検出部)27、28のそれぞれは、搭乗者が倒立二輪車1に搭乗したことを検出する装置である。ステップSW27、28のぞれぞれは、左右のステップカバー(ステップ部)3のそれぞれの下方に配置される。ステップSW27、28は、搭乗者がステップカバー3に乗ることによって搭乗者から加えられた荷重によってステップカバー3が押し下げられた際に、ステップカバー3の下面から加えられる押圧によって押下される。ステップSW27、28のそれぞれは、ステップカバー3から押下されている間、押下されていることを通知するON信号をマイコン11、12に出力する。すなわち、ステップSW27が出力するON信号は、左のステップカバー3に搭乗者が左足を乗せていることを通知する信号として機能し、ステップSW28が出力するON信号は、右のステップカバー3に搭乗者が右足を乗せていることを通知する信号として機能する。   Each of the step SWs (detection units) 27 and 28 is a device that detects that the passenger has boarded the inverted motorcycle 1. Each of the step SWs 27 and 28 is disposed below the left and right step covers (step units) 3. Steps SW27 and 28 are pressed by a pressure applied from the lower surface of the step cover 3 when the step cover 3 is pushed down by a load applied by the passenger when the passenger rides on the step cover 3. Each of the step SWs 27 and 28 outputs an ON signal to the microcomputers 11 and 12 for notifying that it is being pressed while being pressed from the step cover 3. That is, the ON signal output from the step SW27 functions as a signal for notifying that the occupant is on the left step cover 3, and the ON signal output from the step SW28 is applied to the right step cover 3. It functions as a signal for notifying that the person is carrying the right foot.

マイコン11、12のそれぞれは、ステップSW27、28からON信号の出力を受けている間、倒立二輪車1の倒立制御を実施する。これによって、搭乗者がステップカバー3に乗って倒立二輪車1に搭乗している間だけ、倒立二輪車1が倒立制御されて走行することになる。マイコン11、12は、ステップSW27、28のうち、少なくともいずれか1つからON信号の出力を受けているときに、倒立二輪車1の倒立制御を実施するようにしてもよい。しかしながら、好ましくは、搭乗者が搭乗中に倒立二輪車1が走行を開始してしまうことを防止するために、両方のステップSW27、28からON信号の出力を受けているときに、倒立二輪車1の倒立制御を実施するとよい。これによれば、搭乗者が倒立二輪車1に搭乗する際の安全性を、より向上することができる。   Each of the microcomputers 11 and 12 performs the inverted control of the inverted motorcycle 1 while receiving the output of the ON signal from the steps SW27 and 28. As a result, the inverted motorcycle 1 travels while being inverted and controlled while the passenger is riding on the step cover 3 and riding the inverted motorcycle 1. The microcomputers 11 and 12 may perform the inversion control of the inverted motorcycle 1 when receiving an ON signal output from at least one of the steps SW27 and 28. However, preferably, in order to prevent the inverted motorcycle 1 from starting running while the passenger is on board, when the ON signal is output from both the steps SW27 and 28, the inverted motorcycle 1 Inversion control should be implemented. According to this, it is possible to further improve the safety when the passenger gets on the inverted motorcycle 1.

また、マイコン11、12のそれぞれは、ステップSW27、28の両方からON信号の出力を受けていないときに、牽引モード切り替えボタンがユーザから押下された場合に、牽引モードに切り替わり、モータ17、18を制御する。   Each of the microcomputers 11 and 12 switches to the traction mode when the traction mode switching button is pressed by the user when the ON signal is not output from both the steps SW27 and 28, and the motors 17 and 18 are switched. To control.

続いて、図3を参照して、実施の形態にかかるマイコン11、12の詳細構成について説明する。図3は、実施の形態にかかるマイコン11、12の詳細構成を示す図である。   Next, a detailed configuration of the microcomputers 11 and 12 according to the embodiment will be described with reference to FIG. FIG. 3 is a diagram illustrating a detailed configuration of the microcomputers 11 and 12 according to the embodiment.

マイコン11、12のそれぞれは、上述したように、倒立二輪車1の制御に関する各種処理を実行するCPU110、120のそれぞれを有する。CPU110、120のそれぞれは、所定の一定時間(処理インターバル時間)経過する毎に所定の処理を実行する。例えば、CPU110、120のそれぞれは、所定の処理として、センサ(ジャイロセンサ23、24及び回転角センサ19〜22)のそれぞれからセンサ値(角速度信号及び回転角信号)を取得するセンサ取得処理、取得したセンサ値(角速度信号及び回転角信号のそれぞれが示すピッチ角速度及びモータ17、18の回転角)に基づいて指令値を算出する姿勢制御処理、及び、算出した指令値をインバータ13〜16のそれぞれに出力するモータ出力処理等を実行する。なお、これらの処理は、それぞれ同一タイミングで一定時間間隔毎に実施されるようにしてもよく、それぞれ異なるタイミングで一定時間間隔毎に実施されるようにしてもよい。また、これらの処理の実行間隔は、それぞれ同一時間間隔であってもよく、異なる時間間隔であってもよい。   As described above, each of the microcomputers 11 and 12 includes the CPUs 110 and 120 that execute various processes related to the control of the inverted motorcycle 1. Each of the CPUs 110 and 120 executes a predetermined process each time a predetermined fixed time (processing interval time) elapses. For example, each of the CPUs 110 and 120 obtains sensor values (angular velocity signals and rotation angle signals) from the sensors (gyro sensors 23 and 24 and rotation angle sensors 19 to 22) as predetermined processing, and acquires the sensor values. Attitude control processing for calculating a command value based on the sensor values (the pitch angular velocity and the rotation angle of the motors 17 and 18 indicated by each of the angular velocity signal and the rotation angle signal), and the calculated command value for each of the inverters 13 to 16 The motor output process etc. to output to are executed. These processes may be performed at regular time intervals at the same timing, or may be performed at regular time intervals at different timings. In addition, the execution intervals of these processes may be the same time interval or different time intervals.

ここで、CPU110、120のそれぞれは、CPU110、120のそれぞれにおける処理のタイミングを生成するタイマ111、121を有する。タイマ111、121のそれぞれは、カウンタ値として時間を計測するカウンタ(図示せず)を内蔵する。タイマ111は、クロック生成回路25からのクロック信号ClkAに基づいて、カウンタのカウンタ値を更新する。タイマ121は、クロック生成回路26のそれぞれからのクロック信号ClkBに基づいて、カウンタのカウンタ値を更新する。タイマ111、121のそれぞれは、例えば、クロック信号の立ち上がりエッジの入力タイミングで、カウンタのカウンタ値を更新する。なお、タイマ111、121のそれぞれは、例えば、クロック信号の立ち下がりエッジの入力タイミングで、カウンタのカウンタ値を更新するものであってもよい。   Here, each of the CPUs 110 and 120 includes timers 111 and 121 that generate processing timings in the CPUs 110 and 120, respectively. Each of the timers 111 and 121 includes a counter (not shown) that measures time as a counter value. The timer 111 updates the counter value of the counter based on the clock signal ClkA from the clock generation circuit 25. The timer 121 updates the counter value of the counter based on the clock signal ClkB from each of the clock generation circuits 26. Each of the timers 111 and 121 updates the counter value of the counter, for example, at the input timing of the rising edge of the clock signal. Note that each of the timers 111 and 121 may update the counter value of the counter at the input timing of the falling edge of the clock signal, for example.

CPU110、120のそれぞれは、タイマ111、121のそれぞれが計測する時間に基づいて、上述した一定時間間隔毎の処理を実行する。具体的には、CPU110、120のそれぞれは、タイマ111、121のそれぞれのカウンタに対して、カウンタ値の初期値を設定する。タイマ111、121のそれぞれは、クロック信号に基づいてカウンタのカウンタ値を初期値からカウントダウンしていき、カウンタ値がアンダーフローしたとき(0からさらに−1した値となったとき)に割り込み信号をCPU110、120のそれぞれの内部で発生させる。これにより、割り込み信号が、カウンタ値の初期値に応じた一定時間間隔毎に発生する。すなわち、CPU110、120のそれぞれが設定するカウンタ値の初期値は、所望の一定時間を計測するように予め定められている。CPU110、120のそれぞれは、タイマ111、121のそれぞれからの割り込み信号に基づいて、一定時間間隔毎に処理を実行する。例えば、割り込み信号が1ms毎に発生し、10ms毎に実行する必要がある処理がある場合、CPU110、120のそれぞれは、割り込み信号の発生に応じて動作して割り込み信号の発生回数をカウントすることで、10回の割り込み信号の発生をカウントする毎に、その処理を実行するようにする。また、タイマ111、121のそれぞれは、カウンタ値がアンダーフローしたときに、カウンタのカウンタ値を初期値に初期化するとともに、初期値からのカウントダウンを再開する。   Each of the CPUs 110 and 120 executes the above-described processing at regular time intervals based on the time measured by each of the timers 111 and 121. Specifically, each of the CPUs 110 and 120 sets an initial counter value for each counter of the timers 111 and 121. Each of the timers 111 and 121 counts down the counter value from the initial value based on the clock signal, and outputs an interrupt signal when the counter value underflows (when the counter value further decreases from -1). It is generated inside each of the CPUs 110 and 120. Thereby, an interrupt signal is generated at regular time intervals corresponding to the initial value of the counter value. That is, the initial value of the counter value set by each of the CPUs 110 and 120 is determined in advance so as to measure a desired fixed time. Each of the CPUs 110 and 120 executes processing at regular time intervals based on the interrupt signals from the timers 111 and 121, respectively. For example, when an interrupt signal is generated every 1 ms and there is a process that needs to be executed every 10 ms, each of the CPUs 110 and 120 operates in response to the generation of the interrupt signal and counts the number of times the interrupt signal is generated. Thus, every time the generation of 10 interrupt signals is counted, the processing is executed. Further, each of the timers 111 and 121 initializes the counter value of the counter to the initial value when the counter value underflows, and restarts the countdown from the initial value.

ここで、クロック生成回路25、26のそれぞれから出力されるクロック信号ClkA、ClkBの間でズレがある場合、タイマ111、121のそれぞれで計測する時間(カウンタ値)にもズレが生じてしまい、CPU110とCPU120が同期して処理を実行することができなくなってしまう。   Here, when there is a deviation between the clock signals ClkA and ClkB output from each of the clock generation circuits 25 and 26, the time (counter value) measured by each of the timers 111 and 121 is also shifted, The CPU 110 and the CPU 120 cannot execute processing in synchronization.

ここで、図4に示すように、クロック信号のズレを決める要素として、「オフセット」と「傾き」がある。オフセットは、同一の時間を刻むべきクロック信号の立ち上がりエッジのズレである。傾きは、クロック信号のパルス幅のズレである。すなわち、タイマ111、121のそれぞれに対するクロック信号ClkA、ClkBでオフセットがある場合、タイマ111、121のそれぞれで同一時間を計測するタイミング(同一のカウンタ値にカウントダウンするタイミング)にズレが生じていることになる。また、タイマ111、121のそれぞれに対するクロック信号ClkA、ClkB間で傾きがある場合、パルス幅が大きいクロック信号によって計測されるタイマの方が、パルス幅の小さいクロック信号によって計測されるタイマよりも、遅く時間を計測する(遅くカウンタ値をカウントダウンする)ことになる。   Here, as shown in FIG. 4, there are “offset” and “slope” as factors that determine the deviation of the clock signal. The offset is a deviation of the rising edge of the clock signal that should have the same time. The slope is a shift in the pulse width of the clock signal. That is, when there is an offset in the clock signals ClkA and ClkB for each of the timers 111 and 121, there is a deviation in the timing for measuring the same time in each of the timers 111 and 121 (timing to count down to the same counter value). become. Further, when there is a slope between the clock signals ClkA and ClkB for each of the timers 111 and 121, the timer measured by the clock signal having a large pulse width is more than the timer measured by the clock signal having a small pulse width. The time is measured later (counter value is counted down later).

本実施の形態では、ステップSW27、28のそれぞれから出力されるON信号が、CPU110、120のそれぞれに同時に入力されることを利用して、クロック信号ClkA、ClkB間のズレを検出し、検出したズレの分、タイマ111、121の時間(カウンタ値)を補正する。これによって、CPU110、120のそれぞれにおける処理を同期して実行することを可能とする。   In the present embodiment, the shift between the clock signals ClkA and ClkB is detected by using the fact that the ON signals output from the steps SW27 and 28 are simultaneously input to the CPUs 110 and 120, respectively. The time (counter value) of the timers 111 and 121 is corrected by the amount of deviation. As a result, the processing in each of the CPUs 110 and 120 can be executed synchronously.

続いて、図5を参照して、実施の形態にかかる時間同期方法の概要について説明する。図5は、実施の形態にかかる時間同期方法の概要を説明するための図である。   Next, an overview of the time synchronization method according to the embodiment will be described with reference to FIG. FIG. 5 is a diagram for explaining the outline of the time synchronization method according to the embodiment.

図5において、「ClkA」は、上述と同様にクロック生成回路25からCPU110に供給されるクロック信号を示しており、「ClkB」は、上述と同様にクロック生成回路26からCPU120に供給されるクロック信号を示している。「T1」は、あるタイミングを示しており、「T2」は、T1よりも後のタイミングを示しており、「T3」は、T2よりも後のタイミングを示している。なお、「T2」と「T3」は、同一タイミングであってもよい。   In FIG. 5, “ClkA” indicates a clock signal supplied from the clock generation circuit 25 to the CPU 110 as described above, and “ClkB” indicates a clock supplied from the clock generation circuit 26 to the CPU 120 as described above. The signal is shown. “T1” indicates a certain timing, “T2” indicates a timing after T1, and “T3” indicates a timing after T2. “T2” and “T3” may be at the same timing.

本実施の形態では、次式(1)及び(2)に示す思想に基づいてタイマ111とタイマ121の現在の時間を同期する。   In the present embodiment, the current times of the timer 111 and the timer 121 are synchronized based on the idea shown in the following equations (1) and (2).

Tc0(t)=T0(t)−T03 ・・・ (1)
Tc1(t)=(T1(t)−T13)×(T02−T01)/(T12−T11) ・・・ (2)
Tc0 (t) = T0 (t) −T03 (1)
Tc1 (t) = (T1 (t) −T13) × (T02−T01) / (T12−T11) (2)

ここで、式(1)及び(2)で示す各値は、以下の内容となる。
T0(t) :0系のタイマ111の現在の時間
T1(t) :1系のタイマ121の現在の時間
Tc0(t):0系のタイマ111の補正後の現在の時間
Tc1(t):1系のタイマ121の補正後の現在の時間
T01 :タイミングT1における0系のタイマ111の時間
T02 :タイミングT2における0系のタイマ111の時間
T03 :タイミングT3における0系のタイマ111の時間
T11 :タイミングT1における1系のタイマ121の時間
T12 :タイミングT2における1系のタイマ121の時間
T13 :タイミングT3における1系のタイマ121の時間
Here, each value shown by Formula (1) and (2) becomes the following contents.
T0 (t): Current time of 0-system timer 111 T1 (t): Current time of 1-system timer 121 Tc0 (t): Current time after correction of 0-system timer 111 Tc1 (t): Current time after correction of 1-system timer 121 T01: Time of 0-system timer 111 at timing T1 T02: Time of 0-system timer 111 at timing T2 T03: Time of 0-system timer 111 at timing T3 T11: Time of system 1 timer 121 at timing T1 T12: Time of system 1 timer 121 at timing T2 T13: Time of system 1 timer 121 at timing T3

式(1)の「T0(t)−T03」及び式(2)の「T1(t)−T13」は、タイマ111、121の現在の時間T0(t)、T1(t)のそれぞれを、同一のタイミングT3を基準とした時間に補正することになる。これによれば、T3において、タイマ111の時間とタイマ121の時間とが同一の時間とすることができる。すなわち、本補正によれば、オフセットによる時間のズレを無くすことができる。   “T0 (t) -T03” in the equation (1) and “T1 (t) -T13” in the equation (2) indicate the current times T0 (t) and T1 (t) of the timers 111 and 121, respectively. The time is corrected based on the same timing T3. According to this, at T3, the time of the timer 111 and the time of the timer 121 can be set to the same time. That is, according to this correction, it is possible to eliminate time deviation due to offset.

また、式(2)の「(T02−T01)/(T12−T11)」において、「T02−T01」は、クロック信号ClkAに基づいてタイマ111が計測したT1からT2までの時間であり、「T12−T11」は、クロック信号ClkBに基づいてタイマ121が計測したT1からT2までの時間である。したがって、「(T02−T01)/(T12−T11)」は、タイマ121の時間計測速度に対するタイマ111の時間計測速度の割合となる。よって、タイマ121の現在の時間に対して、「(T02−T01)/(T12−T11)」を乗じることで、タイマ121の現在の時間を、タイマ111で計測した場合における現在の時間に補正することができる。すなわち、本補正によれば、傾きによる時間のズレを無くすことができる。   Further, in “(T02−T01) / (T12−T11)” of Expression (2), “T02−T01” is a time from T1 to T2 measured by the timer 111 based on the clock signal ClkA. "T12-T11" is the time from T1 to T2 measured by the timer 121 based on the clock signal ClkB. Therefore, “(T02−T01) / (T12−T11)” is the ratio of the time measurement speed of the timer 111 to the time measurement speed of the timer 121. Therefore, by multiplying the current time of the timer 121 by “(T02−T01) / (T12−T11)”, the current time of the timer 121 is corrected to the current time when measured by the timer 111. can do. That is, according to this correction, it is possible to eliminate a time lag due to inclination.

以上より、上記の思想によれば、タイマ121の現在の時間T1(t)のオフセットを補正した上で、そのオフセットを補正したタイマ121の現在の時間「T1(t)−T13」を、タイマ111と同じ時間計測速度で計測した場合における時間に補正するようにしているため、タイマ121の現在の時間T1(t)を、タイマ111の現在の時間Tc0(t)に一致させた時間Tc1(t)に補正することができる。   As described above, according to the above idea, after correcting the offset of the current time T1 (t) of the timer 121, the current time “T1 (t) −T13” of the timer 121 corrected for the offset is set to the timer 111, the current time T1 (t) of the timer 121 is made equal to the current time Tc0 (t) of the timer 111. t) can be corrected.

このように、本実施の形態では、T3でタイマ111とタイマ121の時間をリセットして一致させ、T1からT2までをタイマ111で計測した時間と、T1からT2までをタイマ121で計測した時間との比率に基づいて、その後にタイマ121で計測される時間(カウンタ値)を適宜補正することで、タイマ111とタイマ121の時間を同期する。   As described above, in the present embodiment, the times of the timers 111 and 121 are reset to coincide with each other at T3, the time measured by the timer 111 from T1 to T2, and the time measured by the timer 121 from T1 to T2. Based on the ratio, the time of the timer 111 and the timer 121 is synchronized by appropriately correcting the time (counter value) subsequently measured by the timer 121.

続いて、図6を参照して、実施の形態にかかる倒立二輪車1の時間同期処理について説明する。図6は、実施の形態にかかる倒立二輪車1の時間同期処理を示すフローチャートである。図7は、実施の形態に係る時間同期方法の詳細を説明するための図である。   Then, with reference to FIG. 6, the time synchronization process of the inverted two-wheeled vehicle 1 concerning embodiment is demonstrated. FIG. 6 is a flowchart showing time synchronization processing of the inverted motorcycle 1 according to the embodiment. FIG. 7 is a diagram for explaining the details of the time synchronization method according to the embodiment.

ここで、図7に示す各値は、以下の内容となる。
C00 :0系のタイマ111のカウンタの初期値
C01 :1系のタイマ121のカウンタの初期値(C01=C00)
C0_12:T1からT2までの0系のタイマ111のカウンタのカウント数
C1_12:T1からT2までの1系のタイマ121のカウンタのカウント数
C0_F :T2における0系のタイマ111のカウンタ値(T2から直後の割り込み
時までの0系のタイマ111のカウンタのカウント数に相当)
C1_F :T2における1系のタイマ121のカウンタ値(T2から直後の割り込み
時までの1系のタイマ121のカウンタのカウント数に相当)
C0_23予想値:T2からT3までの0系のタイマ111のカウンタのカウント数
(1系のCPU120が予想した値)
C1_23 :T2からT3までの1系のタイマ121のカウンタのカウント数
C0_O予想値 :T3の直前の割り込み時からT3までの0系のタイマ111のカウ
ンタのカウント数(1系のCPU120が予想した値)
C0_C予想値 :T3におけるカウンタ値(T3から直後の割り込み時までの0系の
タイマ111のカウンタのカウント数(1系のCPU120が予想
した値)
Here, each value shown in FIG. 7 has the following contents.
C00: Initial value of the counter of the 0-system timer 111 C01: Initial value of the counter of the 1-system timer 121 (C01 = C00)
C0_12: Count number of 0-system timer 111 counter from T1 to T2 C1_12: Count count of 1-system timer 121 counter from T1 to T2 C0_F: Counter value of 0-system timer 111 at T2 (immediately after T2) Interrupt
(Equivalent to the count of the counter of the 0-system timer 111 until the time)
C1_F: Counter value of the 1-system timer 121 at T2 (interrupt immediately after T2
(Equivalent to the count of the counter of the 1st timer 121 until the time)
C0_23 expected value: count number of counter of timer 0 of system 0 from T2 to T3
(Values expected by the 1-system CPU 120)
C1 — 23: Count number of 1-system timer 121 counter from T2 to T3 C0_O expected value: Count of 0-system timer 111 from interrupt time immediately before T3 to T3
Count value (value expected by 1-system CPU 120)
C0_C expected value: Counter value in T3 (0 system from T3 to the time of the next interrupt
The count of the counter of the timer 111 (the CPU 120 of the 1 system
Value)

CPU110、120のそれぞれは、所定の一定周期毎に、以降に説明する処理を実行する。例えば、CPU110、120のそれぞれは、タイマ111、121のそれぞれからの割り込み信号の発生に応じて、本処理を実行する。まず、CPU110、120のそれぞれは、ステップカバー3に搭乗者の片足が乗せられたか否かを判定する(S1)。具体的には、CPU110、120のそれぞれは、ステップSW27、28の両方からON信号の出力を受けていない状態から、ステップSW27、28のいずれか一方からON信号の出力を受けている状態となったか否かを判定する。CPU110、120のそれぞれは、ステップSW27、28の両方からON信号の出力を受けていない状態から、ステップSW27、28のいずれか一方からON信号の出力を受けている状態となった場合、搭乗者の片足が乗せられたと判定し、それ以外の場合、搭乗者の片足が乗せられていないと判定する。   Each of the CPUs 110 and 120 executes processing to be described later at predetermined intervals. For example, each of the CPUs 110 and 120 executes this process in response to the generation of an interrupt signal from each of the timers 111 and 121. First, each of the CPUs 110 and 120 determines whether or not one of the passenger's feet is placed on the step cover 3 (S1). Specifically, each of the CPUs 110 and 120 changes from a state where it does not receive an ON signal output from both of the steps SW27 and 28 to a state where it receives an ON signal output from either of the steps SW27 and 28. It is determined whether or not. When each of the CPUs 110 and 120 receives an ON signal output from one of the steps SW27 and 28 from a state in which no ON signal output is received from both the steps SW27 and 28, the passenger It is determined that one leg of the rider has been put on, and in other cases, it is determined that one leg of the passenger is not put on.

ステップカバー3に搭乗者の片足が乗せられたと判定した場合(S1:Yes)、CPU110、120のそれぞれは、そのタイミングT1における時間(0系の時間は「T01」とし、1系の時間は「T11」とする)を記録する(S2)。具体的には、CPU110、120のそれぞれは、T1における時間として、T1でタイマ111、121のそれぞれから取得したカウンタ値を記憶部に格納する。   When it is determined that one foot of the passenger is put on the step cover 3 (S1: Yes), each of the CPUs 110 and 120 determines the time at the timing T1 (the time of the 0 system is “T01”, and the time of the 1 system is “ T11 ") is recorded (S2). Specifically, each of the CPUs 110 and 120 stores the counter value acquired from each of the timers 111 and 121 at T1 as the time at T1 in the storage unit.

ステップカバー3に搭乗者の片足が乗せられていないと判定した場合(S1:No)、CPU110、120のそれぞれは、ステップカバー3に搭乗者の両足が乗せられたか否かを判定する(S3)。具体的には、CPU110、120のそれぞれは、ステップSW27、28のいずれか一方からON信号の出力を受けている状態から、ステップSW27、28の両方からON信号の出力を受けている状態となったか否かを判定する。CPU110、120のそれぞれは、ステップSW27、28のいずれか一方からON信号の出力を受けている状態から、ステップSW27、28の両方からON信号の出力を受けている状態となった場合、搭乗者の両足が乗せられたと判定し、それ以外の場合、搭乗者の両足が乗せられていないと判定する。   When it is determined that one of the passenger's feet is not placed on the step cover 3 (S1: No), each of the CPUs 110 and 120 determines whether or not both feet of the passenger are placed on the step cover 3 (S3). . Specifically, each of the CPUs 110 and 120 changes from a state in which an ON signal is output from one of the steps SW27 and 28 to a state in which an ON signal is output from both of the steps SW27 and 28. It is determined whether or not. When each of the CPUs 110 and 120 receives an ON signal output from one of the steps SW27 and 28, and then receives an ON signal output from both of the steps SW27 and 28, the passenger It is determined that both feet of the rider have been put on, and in other cases, it is determined that both feet of the passenger have not been put.

ステップカバー3に搭乗者の両足が乗せられたと判定した場合(S3:Yes)、CPU110、120のそれぞれは、そのタイミングT2における時間(0系の時間は「T02」とし、1系の時間は「T12」とする)を記録する(S4)。具体的には、CPU110、120のそれぞれは、T2における時間として、T2でタイマ111、121のそれぞれから取得したカウンタ値C0_F、C1_Fと、T1からT2までにカウンタ値がアンダーフローした回数とを記憶部に格納する。なお、CPU110、120のそれぞれは、T1からT2までにカウンタ値がアンダーフローした回数として、T1からT2までに割り込み信号が発生した回数をカウントすればよい。   When it is determined that both feet of the passenger are put on the step cover 3 (S3: Yes), each of the CPUs 110 and 120 determines the time at the timing T2 (the time of the 0 system is “T02” and the time of the 1 system is “ T12 ") is recorded (S4). Specifically, each of the CPUs 110 and 120 stores, as the time at T2, the counter values C0_F and C1_F acquired from the timers 111 and 121 at T2, and the number of times the counter value has underflowed from T1 to T2, respectively. Store in the department. Each of the CPUs 110 and 120 may count the number of times that an interrupt signal has been generated from T1 to T2 as the number of times the counter value has underflowed from T1 to T2.

CPU110は、T1、T2のそれぞれで記録した時間に関する情報(時間情報)を他方のCPU120に送信する(S5)。具体的には、時間情報は、(1)タイマ111のカウンタの初期値C00、(2)T1からT2までのタイマ111のカウント数C0_12、(3)T2におけるタイマ111のカウンタ値(T2から直後の割り込み時までのタイマ111のカウント数)C0_F、が含まれる。   The CPU 110 transmits information (time information) related to the time recorded at each of T1 and T2 to the other CPU 120 (S5). Specifically, the time information includes (1) an initial value C00 of the counter of the timer 111, (2) a count number C0_12 of the timer 111 from T1 to T2, and (3) a counter value of the timer 111 at T2 (immediately after T2). Count number of the timer 111 until the interruption of () C0_F).

(1)初期値C00は、マイコン11の記憶部に予め格納されている。CPU110は、制御装置10が電源ONとなって動作を開始したときに、記憶部から初期値C00を取得して、タイマ111のカウンタに設定する。なお、この動作については、マイコン12、CPU120、及びタイマ121に関しても同様である。すなわち、タイマ121のカウンタの初期値C01も、マイコン12の記憶部に予め格納されている。したがって、CPU110は、タイマ111のカウンタの初期値C00を記憶部から取得して、CPU120に送信する。 (1) The initial value C00 is stored in advance in the storage unit of the microcomputer 11. The CPU 110 acquires the initial value C00 from the storage unit and sets it in the counter of the timer 111 when the control device 10 starts operating with the power turned on. This operation is the same for the microcomputer 12, the CPU 120, and the timer 121. That is, the initial value C01 of the counter of the timer 121 is also stored in advance in the storage unit of the microcomputer 12. Therefore, the CPU 110 acquires the initial value C00 of the counter of the timer 111 from the storage unit and transmits it to the CPU 120.

(2)カウント数C0_12は、T1からT2までをクロック信号ClkAに基づいてタイマ111で計測した時間「T02−T01」に相当する。カウント数C0_12は、CPU110がステップS2、4のそれぞれで記録した時間T01、T02に基づいて算出される。CPU110は、カウント数C0_12を算出して、CPU120に送信する。カウント数「C0_12」は、例えば、次式(3)によって算出すればよいが、これに限られない。なお、CPU110は、「T1からT2までのタイマ111のアンダーフロー回数」として、T1からT2までに割り込み信号が発生した回数をカウントすればよい。また、CPU110は、「T1におけるタイマ111のカウンタ値」として、ステップS2で記録したカウンタ値を記憶部から取得する。また、CPU110は、「T2におけるタイマ111のカウンタ値」として、ステップS3で記録したカウンタ値を記憶部から取得する。 (2) The count number C0_12 corresponds to a time “T02−T01” when the timer 111 measures T1 to T2 based on the clock signal ClkA. The count number C0_12 is calculated based on the times T01 and T02 recorded by the CPU 110 in steps S2 and S2, respectively. CPU110 calculates count number C0_12, and transmits to CPU120. The count number “C0 — 12” may be calculated by the following equation (3), for example, but is not limited thereto. The CPU 110 may count the number of times that an interrupt signal is generated from T1 to T2 as “the number of underflows of the timer 111 from T1 to T2.” Further, the CPU 110 acquires the counter value recorded in step S2 from the storage unit as “the counter value of the timer 111 at T1”. Further, the CPU 110 acquires the counter value recorded in step S3 from the storage unit as “the counter value of the timer 111 at T2”.

C0_12 =
C00×(T1からT2までのタイマ111のアンダーフロー回数−1)
+T1におけるタイマ111のカウンタ値
+C00−T2におけるタイマ111のカウンタ値C0_F ・・・ (3)
C0_12 =
C00 × (number of underflows of timer 111 from T1 to T2−1)
Counter value of timer 111 at + T1 Counter value C0_F of timer 111 at + C00-T2 (3)

(3)カウンタ値C0_Fは、ステップS3で時間T02として記録されている。したがって、CPU110は、ステップS3で記録したカウンタ値C0_Fを記憶部から取得して、CPU120に送信する。 (3) The counter value C0_F is recorded as time T02 in step S3. Therefore, the CPU 110 acquires the counter value C0_F recorded in step S3 from the storage unit and transmits it to the CPU 120.

CPU120は、CPU110から送信された時間情報の受信に応じて、受信した時間情報を利用して、タイマ111とタイマ121の時間が同期するようにタイマ121の時間を補正する(S6)。ここで、CPU120がCPU110から時間情報を受信したタイミングをT3(0系の時間は「T03」とし、1系の時間は「T13」とする)とする。具体的には、CPU120は、次式(4)〜(7)によって、T3でタイマ121のカウンタに設定する補正後のカウンタ値「C1_C補正後」を算出する。また、CPU120は、式(8)によって、それ以降のタイマ121のカウンタの補正後の初期値「C01補正後」を算出する。   In response to the reception of the time information transmitted from the CPU 110, the CPU 120 corrects the time of the timer 121 so that the times of the timer 111 and the timer 121 are synchronized using the received time information (S6). Here, the timing at which the CPU 120 receives the time information from the CPU 110 is T3 (the time of system 0 is “T03” and the time of system 1 is “T13”). Specifically, the CPU 120 calculates a corrected counter value “after C1_C correction” set in the counter of the timer 121 at T3 by the following equations (4) to (7). Further, the CPU 120 calculates an initial value “after C01 correction” after correction of the counter of the timer 121 thereafter by the equation (8).

C0_23予想値 = C1_23×(C0_12/C1_12) ・・・ (4)
C0_O予想値 = (C0_23予想値−C0_F) mod C00 ・・・ (5)
C0_C予想値 = C00−C0_O予想値 ・・・ (6)
C1_C補正後 = C0_C予想値×(C1_12/C0_12) ・・・ (7)
C01補正後 = C00×(C1_12/C0_12) ・・・ (8)
C0_23 expected value = C1_23 × (C0_12 / C1_12) (4)
C0_O predicted value = (C0_23 predicted value−C0_F) mod C00 (5)
C0_C expected value = C00-C0_O expected value (6)
After C1_C correction = C0_C expected value × (C1_12 / C0_12) (7)
After C01 correction = C00 × (C1 — 12 / C0 — 12) (8)

まず、式(4)について説明する。式(4)によって算出されるカウント数「C0_23予想値」は、T2からT3までをクロック信号ClkAに基づいてタイマ111で計測した時間に相当する。カウント数「C_012」は、上述した通り、T1からT2までをクロック信号ClkAに基づいてタイマ111で計測した時間に相当する。カウント数「C1_12」は、T1からT2までをクロック信号ClkBに基づいてタイマ121で計測した時間「T12−T11」に相当する。したがって、「(C0_12/C1_12)」は、タイマ121の時間計測速度(カウンタのカウントダウン速度)に対するタイマ111の時間計測速度(カウンタのカウントダウン速度)の割合となる。   First, equation (4) will be described. The count number “C0 — 23 expected value” calculated by Expression (4) corresponds to the time measured by the timer 111 from T2 to T3 based on the clock signal ClkA. As described above, the count number “C — 012” corresponds to the time measured by the timer 111 from T1 to T2 based on the clock signal ClkA. The count number “C1_12” corresponds to the time “T12−T11” when the timer 121 measures the time from T1 to T2 based on the clock signal ClkB. Therefore, “(C0 — 12 / C1 — 12)” is a ratio of the time measurement speed (counter countdown speed) of the timer 111 to the time measurement speed (counterdown speed of the counter) of the timer 121.

また、カウント数「C1_23」は、T2からT3までをクロック信号ClkBに基づいてタイマ121で計測した時間「T13−T12」に相当する。よって、式(4)に示すように、T2からT3までのタイマ121のカウント数「C1_23」に、「(C0_12/C1_12)」を乗じることで、T2からT3までのタイマ111のカウント数「C0_23予想値」を算出することができる。なお、カウント数「C1_12」、「C1_23」のそれぞれは、例えば、次式(9)、(10)によって算出すればよいが、これに限られない。なお、CPU120は、「T1からT2までのタイマ121のアンダーフロー回数」として、T1からT2までに割り込み信号が発生した回数をカウントすればよく、「T2からT3までのタイマ121のアンダーフロー回数」として、T2からT3までに割り込み信号が発生した回数をカウントすればよい。また、CPU120は、「T1におけるタイマ121のカウンタ値」として、ステップS2で記録したカウンタ値を記憶部から取得し、「T2におけるタイマ121のカウンタ値」として、ステップS3で記録したカウンタ値を記憶部から取得する。また、CPU120は、「T2におけるタイマ121のカウンタ値」として、現在(T3)のタイマ121のカウンタ値を、タイマ121から取得する。   The count number “C1 — 23” corresponds to a time “T13−T12” when the timer 121 measures T2 to T3 based on the clock signal ClkB. Therefore, as shown in the equation (4), the count number “C1 — 23” of the timer 121 from T2 to T3 is multiplied by “(C0 — 12 / C1 — 12)” to obtain the count number “C0 — 23” of the timer 111 from T2 to T3. An “expected value” can be calculated. The count numbers “C1_12” and “C1_23” may be calculated by, for example, the following equations (9) and (10), but are not limited thereto. The CPU 120 may count the number of times the interrupt signal is generated from T1 to T2 as “the number of underflows of the timer 121 from T1 to T2,” and “the number of underflows of the timer 121 from T2 to T3”. As a result, the number of times the interrupt signal is generated from T2 to T3 may be counted. Further, the CPU 120 acquires the counter value recorded in step S2 as “the counter value of the timer 121 at T1,” and stores the counter value recorded in step S3 as “the counter value of the timer 121 in T2.” Get from the department. Further, the CPU 120 obtains the current (T3) counter value of the timer 121 from the timer 121 as “the counter value of the timer 121 at T2”.

C1_12 =
C11×(T1からT2までのタイマ121のアンダーフロー回数−1)
+T1におけるタイマ121のカウンタ値
+C11−T2におけるタイマ121のカウンタ値C1_F ・・・ (9)
C1_23 =
C11×(T2からT3までのタイマ121のアンダーフロー回数−1)
−T2におけるタイマ121のカウンタ値C1_F
+C11−T3におけるタイマ121のカウンタ値 ・・・ (10)
C1_12 =
C11 × (number of underflows of timer 121 from T1 to T2−1)
Counter value of timer 121 at + T1 Counter value C1_F of timer 121 at + C11−T2 (9)
C1_23 =
C11 × (number of underflows of timer 121 from T2 to T3−1)
-Counter value C1_F of timer 121 at T2
The counter value of the timer 121 at + C11-T3 (10)

次に、式(5)について説明する。式(5)によって算出される「C0_O予想値」は、T3の直前の割り込み時からT3までをクロック信号ClkAに基づいてタイマ111で計測した時間に相当する。カウント数「C0_23予想値」からカウンタ値「C0_F」を減算することで、カウント数「C0_23予想値」から、T2から直後の割り込み時までの時間(カウント数)を減算することができる。よって、式(5)に示すように、「(C0_23予想値−C0_F)」から「C00」を除算することで、その余りとして、T3の直前の割り込み時からT3までのカウント数「C0_O予想値」を算出することができる。   Next, equation (5) will be described. The “C0_O expected value” calculated by the equation (5) corresponds to the time measured by the timer 111 from the time of interruption immediately before T3 to T3 based on the clock signal ClkA. By subtracting the counter value “C0_F” from the count number “C0_23 expected value”, the time (count number) from T2 to the next interrupt time can be subtracted from the count number “C0_23 expected value”. Therefore, as shown in Expression (5), by dividing “C00” from “(C0_23 expected value−C0_F)”, the remainder is the count number “C0_O expected value from the time of the interrupt immediately before T3 to T3”. Can be calculated.

次に、式(6)について説明する。式(6)によって算出される「C0_C予想値」は、T3から直後の割り込み発生時までの時間に相当する。よって、式(6)に示すように、割り込み発生間隔に相当するカウント数「C00」から、T3の直前の割り込み時からT3までのカウント数「C0_O予想値」を減算することで、T3から直後の割り込み発生時までのカウント数「C0_C予想値」を算出することができる。   Next, equation (6) will be described. The “C0_C expected value” calculated by equation (6) corresponds to the time from T3 to the time of the next interrupt. Therefore, as shown in Expression (6), immediately after T3, the count number “C0_O expected value” from the time of the interrupt immediately before T3 to T3 is subtracted from the count number “C00” corresponding to the interrupt generation interval. It is possible to calculate the count number “C0_C expected value” until the occurrence of the interrupt.

以上の式(4)〜(6)によって、「C0_C予想値」として、T3における0系のタイマ111のカウンタ値を推定することができる。よって、CPU120は、T3において、「C0_C予想値」をタイマ121のカウンタにカウンタ値として設定することで、タイマ121の時間(カウンタ値)をタイマ111の時間(カウンタ値)と同期して、同一の時間とすることができる。すなわち、オフセットによる時間のズレを無くすことができる。   From the above equations (4) to (6), the counter value of the 0-system timer 111 at T3 can be estimated as “C0_C expected value”. Therefore, the CPU 120 sets the “C0_C expected value” to the counter of the timer 121 as the counter value at T3, thereby synchronizing the time of the timer 121 (counter value) with the time of the timer 111 (counter value). Time. That is, the time shift due to the offset can be eliminated.

しかし、カウンタ値「C0_C予想値」をタイマ121のカウンタにそのまま設定しただけでは、傾きによって、次にタイマ111、121のそれぞれのカウンタ値がアンダーフローするタイミング(CPU110、120のそれぞれの割り込み発生タイミング)にズレが生じてしまう。そのため、式(7)に示すように、カウンタ値「C0_C予想値」に対して、タイマ111の時間計測速度(カウンタのカウントダウン速度)に対するタイマ121の時間計測速度(カウンタのカウントダウン速度)の割合「(C1_12/C0_12)」を乗じることで、タイマ111がカウンタ値「C0_C予想値」からカウントダウンを開始してアンダーフローするタイミングと、タイマ121がアンダーフローするタイミングとが同一となるタイマ121のカウンタ値「C1_C補正後」を算出する。   However, when the counter value “C0_C expected value” is simply set in the counter of the timer 121 as it is, the timing at which the counter values of the timers 111 and 121 underflow next due to the inclination (the interrupt generation timings of the CPUs 110 and 120). ) Will be misaligned. Therefore, as shown in the equation (7), the ratio of the time measurement speed (counter countdown speed) of the timer 121 to the time measurement speed (counter countdown speed) of the timer 111 with respect to the counter value “C0_C expected value” “ (C1 — 12 / C0 — 12) ”, the timer 111 starts counting down from the counter value“ C0_C expected value ”and underflows, and the timer 121 counter value becomes the same as the counter value of the timer 121. “After C1_C correction” is calculated.

このように、CPU120は、T3において、CPU110から受信した時間情報に基づいて、式(4)〜(7)によって算出したカウント値「C1_C補正後」を、タイマ121のカウンタ値に設定する。これによれば、タイマ111、121間のオフセット及び傾きによる時間のズレを無くして、タイマ111とタイマ121の時間を同期することができる。すなわち、CPU110とCPU120で、T3の次の割り込みが同期して発生させることができる。   As described above, the CPU 120 sets the count value “after C1_C correction” calculated by the equations (4) to (7) to the counter value of the timer 121 based on the time information received from the CPU 110 at T3. According to this, it is possible to synchronize the times of the timer 111 and the timer 121 by eliminating the time shift due to the offset and the inclination between the timers 111 and 121. That is, the CPU 110 and the CPU 120 can generate the next interrupt of T3 synchronously.

また、CPU120は、式(8)によって、タイマ121のカウンタの補正後の初期値「C01補正後」を算出する。式(8)に示すように、タイマ111のカウンタの初期値「C00」に上記の割合「(C1_12/C0_12)」を乗じることで、タイマ111がカウンタ値「C00」からカウントダウンを開始してアンダーフローするタイミングと、タイマ121がアンダーフローするタイミングとが同一となるカウンタの初期値「C01補正後」を算出することができる。そして、CPU120は、式(8)によって算出した「C01補正後」を、タイマ121のカウンタの初期値として設定する。これによれば、以降も傾きによる時間のズレを無くして、タイマ111とタイマ121の時間を同期することができる。すなわち、CPU110とCPU120で、T3よりも後の割り込みも同期して発生させることができる。   Further, the CPU 120 calculates an initial value “after C01 correction” after correction of the counter of the timer 121 by the equation (8). As shown in Equation (8), the timer 111 starts counting down from the counter value “C00” by multiplying the initial value “C00” of the timer 111 by the ratio “(C1 — 12 / C0 — 12)”. It is possible to calculate an initial value “after C01 correction” of the counter in which the timing of flow and the timing of underflow of the timer 121 are the same. Then, the CPU 120 sets “after C01 correction” calculated by the equation (8) as the initial value of the counter of the timer 121. According to this, it is possible to synchronize the times of the timer 111 and the timer 121 without any time lag due to the inclination thereafter. That is, the CPU 110 and the CPU 120 can also generate an interrupt after T3 in synchronization.

そして、CPU110、120のそれぞれは、倒立二輪車1の制御に関する処理を実行する(S7)。具体的には、CPU110、120のそれぞれは、タイマ111、121の計測する時間に基づいて、前回のセンサ取得処理、姿勢制御処理、及びモータ出力処理等の実行タイミングとなっている場合には、その処理を実行する。   And each of CPU110,120 performs the process regarding control of the inverted motorcycle 1 (S7). Specifically, each of the CPUs 110 and 120 is based on the time measured by the timers 111 and 121, and when the previous sensor acquisition process, the attitude control process, the motor output process, and the like are executed, The process is executed.

以上に説明した時間同期処理によれば、CU120がCPU110から送信された時間情報に基づいて、CPU120が利用するタイマ121が計測する時間を、CPU110が利用するタイマ111が計測した場合における時間に補正することができる。そのため、CPU110とCPU120のそれぞれで実行する処理の同期の精度を向上することができる。   According to the time synchronization process described above, based on the time information transmitted from the CPU 110 by the CU 120, the time measured by the timer 121 used by the CPU 120 is corrected to the time when the timer 111 used by the CPU 110 measures. can do. Therefore, it is possible to improve the accuracy of synchronization of processes executed by the CPU 110 and the CPU 120.

ここで、センサ取得処理において、ジャイロセンサ23が検出したピッチ角速度と、ジャイロセンサ24が検出したピッチ角速度とを比較して、比較したピッチ角速度が一致するか否かによってジャイロセンサ23又は24の故障を診断する処理を実施する場合を例に挙げて、本実施の形態の効果について説明する。   Here, in the sensor acquisition process, the pitch angular velocity detected by the gyro sensor 23 and the pitch angular velocity detected by the gyro sensor 24 are compared, and the failure of the gyro sensor 23 or 24 depends on whether or not the compared pitch angular velocities match. The effect of the present embodiment will be described by taking as an example the case of performing the process of diagnosing the above.

具体的には、CPU120は、ジャイロセンサ120から出力された角速度信号で示されるピッチ角速度を示す角速度情報を生成してCPU110に出力する。CPU110は、ジャイロセンサ23から出力された角速度信号が示すピッチ角速度と、CPU120から出力された角速度情報が示すピッチ角速度とを比較する。CPU110は、比較したピッチ角速度が一致する場合、ジャイロセンサ23、24が正常に動作していると判定し、比較したピッチ角速度が一致しない場合、ジャイロセンサ23、24のいずれかが故障していると判定する。ここで、CPU110は、微量な検出誤差又は取得タイミングのズレによって、ピッチ角速度が一致しないと判定してしまうことを防止するために、ピッチ角速度に所定閾値以上のズレがない場合に、一致していると判定し、ピッチ角速度に所定閾値以上のズレがある場合に、一致しないと判定するようにする。   Specifically, the CPU 120 generates angular velocity information indicating the pitch angular velocity indicated by the angular velocity signal output from the gyro sensor 120 and outputs the angular velocity information to the CPU 110. The CPU 110 compares the pitch angular velocity indicated by the angular velocity signal output from the gyro sensor 23 with the pitch angular velocity indicated by the angular velocity information output from the CPU 120. If the compared pitch angular velocities match, the CPU 110 determines that the gyro sensors 23 and 24 are operating normally. If the compared pitch angular velocities do not match, one of the gyro sensors 23 and 24 has failed. Is determined. Here, in order to prevent the pitch angular velocities from being determined to be inconsistent due to a small amount of detection error or acquisition timing deviation, the CPU 110 agrees when the pitch angular velocities do not exceed a predetermined threshold value. If the pitch angular velocity is more than a predetermined threshold, it is determined that they do not match.

例えば、図8Aに示すように、CPU110とCPU120が同期して処理を実行することができていない場合には、CPU110が判断するセンサ取得処理の実行タイミングAT01〜AT09と、CPU120が判断するセンサ取得処理の実行タイミングAT11〜AT19とがズレてしまう。この場合、CPU110がジャイロセンサ23から取得するピッチ角速度と、CPU120がジャイロセンサ24から取得するピッチ角速度との差が大きくなってしまう。そのため、ピッチ角速度が一致しないと誤判定してしまうことを防止するために、上述の閾値を大きくとる必要がある。しかしながら、そのように閾値を大きくとってしまうと、故障を検出する精度が低下してしまう。   For example, as illustrated in FIG. 8A, when the CPU 110 and the CPU 120 are not able to execute processing in synchronization, the sensor acquisition processing execution timings AT01 to AT09 determined by the CPU 110 and the sensor acquisition determined by the CPU 120 The process execution timings AT11 to AT19 are misaligned. In this case, the difference between the pitch angular velocity acquired by the CPU 110 from the gyro sensor 23 and the pitch angular velocity acquired by the CPU 120 from the gyro sensor 24 becomes large. Therefore, in order to prevent erroneous determination that the pitch angular velocities do not match, it is necessary to increase the above threshold value. However, if the threshold value is increased as such, the accuracy of detecting a failure is reduced.

それに対して、本実施の形態によれば、図8Bに示すように、CPU110とCPU120が同期して処理を実行することができるため、CPU110が判断するセンサ取得処理の実行タイミングAT01〜AT09と、CPU120が判断するセンサ取得処理の実行タイミングAT11〜AT19とを同期することができる。よって、CPU110がジャイロセンサ23から取得するピッチ角速度と、CPU120がジャイロセンサ24から取得するピッチ角速度との差を低減することができる。これによれば、上述の閾値を大きくとる必要がないため、故障を検出する精度を向上することができる。   On the other hand, according to the present embodiment, as shown in FIG. 8B, the CPU 110 and the CPU 120 can execute the process synchronously, and therefore, the sensor acquisition process execution timings AT01 to AT09 determined by the CPU 110, The sensor acquisition process execution timings AT11 to AT19 determined by the CPU 120 can be synchronized. Therefore, the difference between the pitch angular velocity acquired by the CPU 110 from the gyro sensor 23 and the pitch angular velocity acquired by the CPU 120 from the gyro sensor 24 can be reduced. According to this, since it is not necessary to increase the above-described threshold value, it is possible to improve the accuracy of detecting a failure.

続いて、図9、10を参照して、実施の形態に係る傾き補正の微調整方法について説明する。図9は、傾き補正における問題点を説明するための図である。図10は、実施の形態に係る傾き補正の微調整の一例を示す図である。   Subsequently, a fine adjustment method for tilt correction according to the embodiment will be described with reference to FIGS. FIG. 9 is a diagram for explaining problems in tilt correction. FIG. 10 is a diagram illustrating an example of fine adjustment of inclination correction according to the embodiment.

まず、図9を参照して、傾き補正における問題点について説明する。本実施の形態では、上述したように、タイマ121の初期値に、式(8)によって算出したカウンタの初期値「C01補正後」を設定することで傾きを補正して、タイマ111とタイマ121を同期する。   First, with reference to FIG. 9, problems in tilt correction will be described. In this embodiment, as described above, the initial value of the timer 121 is set to the initial value “after C01 correction” of the counter calculated by the equation (8) to correct the inclination, and the timer 111 and the timer 121 are corrected. Synchronize

しかし、カウンタの初期値「C01補正後」の算出において、図9に示すように、カウンタの初期値「C01補正後」の実演算値が整数とならない場合がある。それに対して、一般的にCPUのタイマのカウンタの初期値には整数しか設定をすることができない。例えば、図9に示すように、カウンタの初期値「C01補正後」の実演算値として「4996.86621094・・・」が算出された場合、タイマ121の初期値「C01補正後」の実設定値は、「4997」となる。すなわち、タイマ121のカウンタの初期値の実演算値と、タイマ121のカウンタの初期値の実設定値との間に誤差が生じてしまうことになる。   However, in the calculation of the initial value “after C01 correction” of the counter, as shown in FIG. 9, the actual operation value of the initial value “after C01 correction” of the counter may not be an integer. On the other hand, generally only an integer can be set as the initial value of the counter of the CPU timer. For example, as shown in FIG. 9, when “4996.866211094...” Is calculated as the actual operation value of the initial value “after C01 correction” of the counter, the actual value of the initial value “after C01 correction” of the timer 121 is calculated. The value is “4997”. That is, an error occurs between the actual operation value of the initial value of the timer 121 counter and the actual set value of the initial value of the timer 121 counter.

この場合、例えば、数秒間、動作を継続すると、誤差が蓄積していき、タイマ111のカウンタ値がアンダーフローして割り込みが発生するタイミングと、タイマ121のカウンタ値がアンダーフローして割り込みが発生するタイミングとにズレが生じてしまう。すなわち、0系のCPU110と1系のCPU120とで処理を同期することができなくなってしまう。   In this case, for example, if the operation is continued for a few seconds, errors accumulate, and the timing at which the timer 111 counter value underflows and an interrupt occurs, and the timer 121 counter value underflows and an interrupt occurs. There will be a gap in the timing of That is, the processing cannot be synchronized between the 0-system CPU 110 and the 1-system CPU 120.

そこで、本実施の形態では、所定の回数、タイマ121のカウンタのアンダーフローが発生する毎に、その回数での誤差の蓄積をカウント数として算出し、算出したカウント数で誤差のするカウンタ値の誤差の蓄積を打ち消すように、タイマ121のカウンタの初期値を補正する。これによって、タイマ121のカウンタの補正後の初期値における実演算値と実設定値との誤差の蓄積を無くして、タイマ110の時間とタイマ121の時間を同期して、タイマ110がアンダーフローするタイミングと、タイマ121がアンダーフローするタイミングとを同期することができる。   Therefore, in this embodiment, every time the counter underflow of the timer 121 occurs for a predetermined number of times, the error accumulation at that number is calculated as the count number, and the counter value that causes an error with the calculated count number is calculated. The initial value of the counter of the timer 121 is corrected so as to cancel the error accumulation. As a result, accumulation of errors between the actual operation value and the actual set value in the corrected initial value of the timer 121 counter is eliminated, and the timer 110 underflows in synchronization with the timer 110 time and the timer 121 time. The timing can be synchronized with the timing at which the timer 121 underflows.

次に、図10を参照して、その処理となる、実施の形態に係る傾き補正の微調整処理について説明する。なお、図10では、上述と同様に、カウンタの補正後の初期値「C01補正後」の実演算値が「4996.86621094・・・」であり、タイマ121の補正後の初期値「C01補正後」の実設定値は、「4997」である場合について説明する。なお、この場合、カウンタの補正後の初期値「C01補正後」における実演算値と実設定値の誤差は、「0.13378906・・・」となる。   Next, with reference to FIG. 10, a fine adjustment process for tilt correction according to the embodiment, which is the process, will be described. In FIG. 10, as described above, the actual calculation value of the initial value “after C01 correction” after correction of the counter is “4996.866211094...”, And the initial value “C01 correction after correction of the timer 121”. The case where the actual setting value of “after” is “4997” will be described. In this case, the error between the actual calculation value and the actual setting value in the initial value “after C01 correction” after correction of the counter is “0.13378906.

この場合、10回のタイマ121の初期化(10回のアンダーフロー、10回の割り込み)毎に、「1.3378906(0.13378906×10)」カウント分、タイマ121のカウントダウンが遅れることになる。すなわち、約1カウント分、タイマ121のカウントダウンの遅れが蓄積することになる。よって、CPU120は、10回のタイマ121の初期化毎に、タイマ121のカウンタの補正後の初期値「C01補正後」の実設定値「4997」を「1」を減算して補正する。具体的には、CPU120は、10回のタイマ121の初期化毎に、カウンタの補正後の初期値の実設定値「4997」を、実設定値から実演算値を減算した値「0.13378906」に補正間隔「10(10回)」を乗じた値「1.3378906」の整数部の値「1」を減算して補正する。   In this case, every time the timer 121 is initialized (10 underflows, 10 interrupts), the count down of the timer 121 is delayed by “1.3378906 (0.13378906 × 10)” counts. . In other words, the count-down delay of the timer 121 is accumulated for about 1 count. Therefore, the CPU 120 corrects the actual set value “4997” of the initial value “after C01 correction” after correction of the counter of the timer 121 by subtracting “1” every time the timer 121 is initialized. Specifically, every time the timer 121 is initialized 10 times, the CPU 120 subtracts the actual operation value from the actual setting value “0.13378906” by subtracting the actual setting value “4997” after the counter correction. ”Is multiplied by the correction interval“ 10 (10 times) ”and the value“ 1 ”of the integer part of the value“ 1.3378906 ”is subtracted and corrected.

例えば、(n×10)回目のタイマ121の初期化時に、タイマ121のカウンタの補正後の初期値「C01補正後」の実設定値を補正する場合には、CPU120は、(n×10−1)回目のタイマ121からの割り込みに応じて、タイマ121のカウンタの初期値を「4996(4997−1)」に変更し、(n×10)回目のタイマ121からの割り込みに応じてタイマ121のカウンタの初期値を「4997」に戻すようにすればよい(ここで、nは、正整数)。   For example, when the actual set value of the initial value “after C01 correction” after correction of the counter of the timer 121 is corrected when the timer 121 is initialized (n × 10) times, the CPU 120 determines that (n × 10− 1) The initial value of the counter of the timer 121 is changed to “4996 (4999-1)” in response to the interrupt from the timer 121 for the first time, and the timer 121 is changed in response to the interrupt from the timer 121 for the (n × 10) time. The initial value of the counter may be returned to “4997” (where n is a positive integer).

また、100回のタイマ121の初期化(100回のアンダーフロー、100回の割り込み)毎に、「13.378906(0.13378906×100)」カウント分、タイマ121のカウントダウンが遅れることになる。すなわち、約13カウント分、タイマ121のカウントダウンの遅れが蓄積することになる。ここで、上述した10回のタイマ121の初期化毎の初期値の補正が行われている場合には、100回のタイマ121の初期化におけるカウントダウンの遅れ「13カウント」のうち、10の位の遅れは補正されているため、1の位の遅れ「3カウント」を補正すればよい。よって、CPU120は、100回のタイマ121の初期化毎に、タイマ121のカウンタの補正後の初期値「C01補正後」の実設定値「4997」を「3」を減算して補正する。具体的には、CPU120は、100回のタイマ121の初期化毎に、カウンタの補正後の初期値の実設定値「4997」を、実設定値から実演算値を減算した値「0.13378906」に補正間隔「100(10回)」を乗じた値「13.378906」の整数部の1の位の値「3」を減算して補正する。   In addition, every time the timer 121 is initialized (100 times underflow, 100 times interrupt), the countdown of the timer 121 is delayed by “13.378906 (0.13378906 × 100)” counts. In other words, the countdown delay of the timer 121 is accumulated for about 13 counts. Here, when the above-described correction of the initial value for each initialization of the timer 121 is performed, the 10th place out of the countdown delay “13 counts” in the initialization of the timer 121 for 100 times. Since the delay of 1 is corrected, the delay of “1 count” “3 counts” may be corrected. Therefore, every time the timer 121 is initialized 100 times, the CPU 120 corrects the actual set value “4997” of the initial value “after C01 correction” after correction of the counter of the timer 121 by subtracting “3”. Specifically, every time the timer 121 is initialized 100 times, the CPU 120 subtracts the actual calculation value from the actual setting value, “0.13378906”, after subtracting the actual setting value “4997” after the counter correction. ”Is multiplied by the correction interval“ 100 (10 times) ”, and the value“ 3 ”of the first place of the integer part of the value“ 13.378906 ”is subtracted and corrected.

よって、CPU120は、上記の10回のタイマ121の初期化毎の補正と合わせると、100回のタイマ121の初期化毎に、タイマ121のカウンタの補正後の初期値として「4993(4997−1−3)」を設定することになる。   Therefore, the CPU 120, when combined with the above-mentioned 10 corrections for each initialization of the timer 121, sets “4993 (4999-1) as the initial value after the correction of the counter of the timer 121 for every 100 initializations of the timer 121. -3) ".

例えば、上記の(n×10)回目のタイマ121の初期化時に加えて、(n×100)回目のタイマ121の初期化時にも、タイマ121のカウンタの補正後の初期値「C01補正後」の実設定値を補正する場合には、CPU120は、(n×100−1)回目のタイマ121からの割り込みに応じて、タイマ121のカウンタの初期値を「4993(4997−1−3)」に変更し、(n×100)回目のタイマ121からの割り込みに応じてタイマ121のカウンタの初期値を「4997」に戻すようにすればよい(ここで、nは、正整数)。すなわち、10回のタイマ121の初期化毎の補正に加えて、100回のタイマ121の初期化毎の補正も実施する場合には、(n×10)回目のタイマ121の初期化時であっても、(n×100)回目のタイマ121の初期化時には、タイマ121のカウンタの初期値が「4996」ではなく、「4993」に変更される。   For example, in addition to the initialization of the (n × 10) -th timer 121 described above, the initial value “after C01 correction” after correction of the counter of the timer 121 is also performed when the timer 121 is initialized (n × 100). When the actual setting value is corrected, the CPU 120 sets the initial value of the counter of the timer 121 to “4993 (4997-1-3)” in response to the (n × 100-1) th interrupt from the timer 121. And the initial value of the counter of the timer 121 may be returned to “4997” in response to the (n × 100) -th interrupt from the timer 121 (where n is a positive integer). That is, in addition to the correction for each initialization of the timer 121 for 10 times, the correction for each initialization of the timer 121 for 100 times is performed at the time of the initialization of the timer 121 for the (n × 10) th time. However, when the timer 121 is initialized for the (n × 100) th time, the initial value of the counter of the timer 121 is changed to “4993” instead of “4996”.

このように、10のn乗回のタイマ121の初期化毎の補正に関する補正値は、実設定値と実演算値の誤差「0.13378906」の小数点第n位の値に10のn乗を乗算した値とすればよい(nは、正整数)。   As described above, the correction value related to the correction for each initialization of the timer 121 for the 10th power is 10 n to the value of the nth decimal point of the error “0.13378906” between the actual setting value and the actual calculation value. A value obtained by multiplication may be used (n is a positive integer).

これによれば、例えば、10回、100回、1000回、10000回、及び100000回のそれぞれのタイマ121の初期化毎に、タイマ121のカウンタの補正後の初期値「C01補正後」を補正する場合、図10に示すように、100000回のタイマ121の初期化毎の補正では、カウンタの補正後の初期値を「4975(4997−1−3−3−7−8)」とすればよい。   According to this, for example, every time the timer 121 is initialized 10 times, 100 times, 1000 times, 10000 times, and 100000 times, the initial value “after C01 correction” after correction of the counter of the timer 121 is corrected. In this case, as shown in FIG. 10, in the correction for every initialization of the timer 121 for 100,000 times, the initial value after the correction of the counter is “4975 (4997-1-3-3-7-8)”. Good.

なお、10の何乗回までタイマ121の初期化毎の補正を行うかは、上記の例に限られず、任意に定めるようにしてよい。例えば、10の1乗(10)回のタイマ121の初期化毎の補正と、10の2乗(100)回のタイマ121の初期化毎の補正だけを実施するようにしてもよい。   It should be noted that the number of times to which the correction is performed every initialization of the timer 121 is not limited to the above example, and may be arbitrarily determined. For example, only 10 1 (10) times of correction of the timer 121 for each initialization and 10 2 (100) times of correction of the timer 121 for each initialization may be performed.

また、タイマ121のカウンタの初期値の補正を行う間隔は、上記の例のように、10のn乗回のそれぞれのタイマ121の初期化毎の間隔に限られず、任意に定めるようにしてよい。例えば、8回のタイマ121の初期化毎にタイマ121のカウンタの初期値の補正を行うようにしてもよい。この場合、8回のタイマ121の初期化毎に、1カウント分(1.07031248(0.13378906×8))、タイマ121のカウンタの初期値を補正するようにすればよい。また、例えば、10回のタイマ121の初期化毎の補正は行わず、100回のタイマ121の初期化毎の補正を行うようにしてもよい。この場合、100回のタイマ121の初期化毎に、13カウント分(13.378906(0.13378906×10)、タイマ121のカウンタの初期値を補正するようにすればよい。   Further, the interval for correcting the initial value of the counter of the timer 121 is not limited to the interval for each initialization of the timer 121 of 10 n times as in the above example, and may be arbitrarily determined. . For example, the initial value of the counter of the timer 121 may be corrected every time the timer 121 is initialized eight times. In this case, every time the timer 121 is initialized eight times, the initial value of the counter of the timer 121 may be corrected by one count (1.07033248 (0.13378906 × 8)). Further, for example, the correction for each initialization of the timer 121 may be performed 100 times without performing the correction for each initialization of the timer 121 10 times. In this case, the initial value of the counter of the timer 121 may be corrected by 13 counts (13.378906 (0.13378906 × 10)) every time the timer 121 is initialized 100 times.

以上に説明したように、本実施の形態では、CPU120は、CPU110から送信された時間情報から得られるT1(第1の所定事象の検出時)からT2(第2の所定事象の検出時)までのタイマ111における経過時間と、T1からT2までのタイマ121における経過時間との比率に基づいて、タイマ121が計測する時間をタイマ111で計測した場合における時間に補正するようにしている。これによれば、タイマ111、タイマ121のそれぞれの時間に基づいてCPU110、120のそれぞれで実行される、倒立二輪車1(同軸二輪移動体)の制御に関する処理の同期の精度を向上することができる。   As described above, in the present embodiment, the CPU 120 is from T1 (when the first predetermined event is detected) to T2 (when the second predetermined event is detected) obtained from the time information transmitted from the CPU 110. Based on the ratio between the elapsed time in the timer 111 and the elapsed time in the timer 121 from T1 to T2, the time measured by the timer 121 is corrected to the time when the timer 111 measures. According to this, it is possible to improve the accuracy of the synchronization of the processing related to the control of the inverted two-wheeled vehicle 1 (coaxial two-wheel moving body) executed by each of the CPUs 110 and 120 based on the respective times of the timer 111 and the timer 121. .

また、本実施の形態では、CPU110及びCPU120は、ステップSW27、28からCPU110及びCPU120のそれぞれに同時に入力される信号の変化に基づいて、時間同期に用いる時間を記録するタイミングT1、T2を検出するようにしている。これによれば、CPU110とCPU120とで、T1、T2として時間を記録するタイミングのズレを無くすことができるため、記録した時間に基づいて算出されるタイマ121の補正後の時間を、より高い精度でタイマ111の時間と同期するように算出することができる。   In the present embodiment, CPU 110 and CPU 120 detect timings T1 and T2 for recording times used for time synchronization based on changes in signals simultaneously input to CPU 110 and CPU 120 from steps SW27 and 28, respectively. I am doing so. According to this, since the CPU 110 and the CPU 120 can eliminate the deviation of the timing for recording the time as T1 and T2, the time after the correction of the timer 121 calculated based on the recorded time can be increased with higher accuracy. Can be calculated so as to be synchronized with the time of the timer 111.

なお、本発明は上記実施の形態に限られたものではなく、趣旨を逸脱しない範囲で適宜変更することが可能である。   Note that the present invention is not limited to the above-described embodiment, and can be changed as appropriate without departing from the spirit of the present invention.

上記の実施の形態では、一例として、搭乗者の一方の足が載置されたことの検出時と、搭乗者の両方の足が載置されたことの検出時に、時間同期に用いる時間を記録するようにしているが、時間同期に用いる時間を記録するトリガとなる事象は、これに限られない。予め任意に定めた2つの所定事象(第1の所定事象及び第2の所定事象)を、時間同期に用いる時間を記録するトリガとして定めるようにしてよい。例えば、補正に用いる時間を記録するトリガとなる2つの事象として、ステップSW27、28からのON信号の有無に基づいて、搭乗者の一方の足が載置されたこと、搭乗者の両方の足が載置されたこと、搭乗者の一方の足が載置されなくなったこと、搭乗者の両方の足が載置されなくなったことのうち、いずれかの相互に異なる事象を検出するようにしてよい。   In the above embodiment, as an example, the time used for time synchronization is recorded when it is detected that one of the passenger's feet is placed and when both the feet of the passenger are placed. However, the event that triggers recording the time used for time synchronization is not limited to this. Two predetermined events (a first predetermined event and a second predetermined event) arbitrarily determined in advance may be determined as triggers for recording the time used for time synchronization. For example, as two events serving as triggers for recording the time used for correction, one of the passenger's feet is placed based on the presence or absence of an ON signal from steps SW27 and 28, and both of the passenger's feet To detect one of the different events among the passengers, the passenger's one foot not being placed, and the passenger's both feet not being placed. Good.

例えば、倒立二輪車1を牽引モードで利用することを考慮すると、好ましくは、T1の事象として搭乗者の一方の足が載置されなくなったことを検出し、T2の事象として搭乗者の両方の足が載置されなくなったことを検出するようにするとよい。具体的には、CPU110、120のそれぞれは、ステップSW27、28のいずれか両方からON信号の出力を受けている状態から、ステップSW27、28の一方からON信号の出力を受けている状態となった場合、搭乗者の一方の足が載置されなくなったと判定する。また、CPU110、120のそれぞれは、ステップSW27、28のいずれか一方からON信号の出力を受けている状態から、ステップSW27、28の両方からON信号の出力を受けていない状態となった場合、搭乗者の両方の足が載置されなくなったと判定する。そのようにすることで、牽引モードで利用するときに、より近い時間帯のクロック信号の状態に基づいて、時間同期処理を実施することになるため、牽引モードで倒立二輪車1の制御に関する処理を、より高い精度で同期することができる。しかしながら、倒立二輪車1を乗車モードで利用することを考慮すると、好ましくは、上記の実施の形態のように、T1の事象として搭乗者の一方の足が載置されたことを検出し、T2の事象として搭乗者の両方の足が載置されたことを検出するようにするとよい。   For example, considering that the inverted motorcycle 1 is used in the traction mode, preferably, it is detected that one of the passenger's feet is not placed as an event of T1, and both of the passenger's feet are detected as an event of T2. It is good to detect that is no longer mounted. Specifically, each of the CPUs 110 and 120 changes from a state in which an ON signal is output from both of the steps SW27 and 28 to a state in which an ON signal is output from one of the steps SW27 and 28. If it is, it is determined that one of the passenger's legs is no longer placed. In addition, when each of the CPUs 110 and 120 is in a state where it has not received an ON signal output from both of the steps SW27 and 28 from a state in which it has received an ON signal output from either of the steps SW27 and 28, It is determined that both feet of the passenger are no longer placed. By doing so, since the time synchronization processing is performed based on the state of the clock signal in a closer time zone when used in the traction mode, the processing related to the control of the inverted motorcycle 1 in the traction mode is performed. , Can be synchronized with higher accuracy. However, in consideration of using the inverted motorcycle 1 in the riding mode, it is preferable to detect that one foot of the passenger is placed as an event of T1, as in the above-described embodiment, As an event, it may be detected that both feet of the passenger are placed.

また、補正に用いる時間を記録するトリガとなる事象として、ステップSW27、28以外のデバイス(降車スイッチ又はリーン角センサ等)からの信号に基づいて判断される事象を用いるようにしてもよい。例えば、降車スイッチは、搭乗者が倒立二輪車1を降車可能な状態へ移行させることを倒立二輪車1に指示するためのスイッチである。降車スイッチは、搭乗者から押下された場合、降車可能な状態への移行を指示する信号をCPU110、120に出力する。CPU110、120のそれぞれは、降車スイッチからの信号の出力に応じて、倒立二輪車1の走行を停止させるように、左右の車輪2を駆動するモータを制御する。そして、CPU110、120のそれぞれは、降車スイッチから信号が出力されたことを、補正に用いる時間を記録するトリガとなる事象として扱うようにしてもよい。また、例えば、リーン角(ロール角)センサは、倒立二輪車1のリーン角を検出し、検出したリーン角を示すリーン角信号をCPU110、120に通知する信号である。そして、CPU110、120は、リーン角信号が示すリーン角が所定角度となったことを、補正に用いる時間を記録するトリガとなる事象として扱うようにしてもよい。   In addition, as an event serving as a trigger for recording the time used for correction, an event determined based on a signal from a device other than the steps SW27 and 28 (alighting switch or a lean angle sensor) may be used. For example, the getting-off switch is a switch for instructing the inverted two-wheeled vehicle 1 that the passenger shifts the inverted two-wheeled vehicle 1 to a state in which the passenger can get off. When the get-off switch is pressed by a passenger, the get-off switch outputs a signal to the CPUs 110 and 120 for instructing a transition to a state where the user can get off. Each of the CPUs 110 and 120 controls the motors that drive the left and right wheels 2 to stop the traveling of the inverted two-wheeled vehicle 1 in accordance with the output of a signal from the getting-off switch. Then, each of the CPUs 110 and 120 may handle the output of a signal from the getting-off switch as an event serving as a trigger for recording the time used for correction. Further, for example, the lean angle (roll angle) sensor is a signal that detects the lean angle of the inverted motorcycle 1 and notifies the CPUs 110 and 120 of a lean angle signal indicating the detected lean angle. Then, the CPUs 110 and 120 may treat the lean angle indicated by the lean angle signal as a predetermined angle as an event serving as a trigger for recording the time used for correction.

また、CPU120は、補正後のカウンタ値「C1_C補正後」を算出して設定することによるタイマ121の時間補正と、補正後のカウンタの初期値「C01補正後」を算出して設定することによるタイマ121の時間補正のうち、いずれかのみを実施するようにしてもよい。しかしながら、好ましくは、上記の実施の形態のように、上記2つの時間補正の両方を実施するようにすることで、より高い精度でタイマ111とタイマ121の時間を同期することができる。   Further, the CPU 120 calculates the time value of the timer 121 by calculating and setting the corrected counter value “after C1_C correction”, and calculates and sets the corrected counter initial value “after C01 correction”. Only one of the time corrections of the timer 121 may be performed. However, preferably, the time of the timer 111 and the timer 121 can be synchronized with higher accuracy by performing both of the two time corrections as in the above embodiment.

また、CPU120は、式(7)によって補正後のカウンタ値「C1_C補正後」を算出するようにしているが、補正後のカウンタ値「C1_C補正後」を「C0_C予想値」として算出するようにしてもよい。これによっても、オフセットの補正は行うことができるからである。しかしながら、好ましくは、上記の実施の形態のように、式(7)によって補正後のカウンタ値「C1_C補正後」を算出するようにすることで、傾きも補正し、より高い精度でタイマ111とタイマ121の時間を同期することができる。   Further, the CPU 120 calculates the corrected counter value “after C1_C correction” according to the equation (7), but calculates the corrected counter value “after C1_C correction” as “C0_C expected value”. May be. This is also because the offset can be corrected. However, preferably, as in the above-described embodiment, by calculating the corrected counter value “after C1_C correction” according to Equation (7), the inclination is also corrected, and the timer 111 and the timer 111 can be corrected with higher accuracy. The time of the timer 121 can be synchronized.

また、上記の実施の形態では、CPU120が、タイマ111のカウンタの初期値「C00」をCPU110から取得するようにしているが、これに限られない。例えば、タイマ111のカウンタの初期値「C00」は、マイコン12の記憶部に予め格納しておくようにし、CPU120が記憶部から取得するようにしてもよい。   In the above embodiment, the CPU 120 acquires the initial value “C00” of the counter of the timer 111 from the CPU 110, but the present invention is not limited to this. For example, the initial value “C00” of the counter of the timer 111 may be stored in advance in the storage unit of the microcomputer 12 and may be acquired from the storage unit by the CPU 120.

また、上記の実施の形態では、CPU110が、カウント数「C0_12」を算出するようにしているが、これに限られない。CPU111が、「T1からT2までのタイマ111のアンダーフロー回数」と「T1におけるタイマ111のカウンタ値」を時間情報に含めてCPU120に送信するようにし、CPU120が、その時間情報に基づいて、カウント数「C0_12」を算出するようにしてもよい。   In the above-described embodiment, the CPU 110 calculates the count number “C0 — 12”, but is not limited thereto. The CPU 111 transmits the time information including “the number of underflows of the timer 111 from T1 to T2” and “the counter value of the timer 111 at T1” to the CPU 120, and the CPU 120 counts based on the time information. The number “C0_12” may be calculated.

また、上記の実施の形態では、タイマ111、121は、カウンタ値がアンダーフローしたとき(0からさらに−1した値となったとき)に、割り込みを発生するとともにカウンタ値を初期化するものであるが、所定値までカウントダウンされたときに、割り込みを発生するとともにカウンタ値を初期化するものであれば、これに限られない。例えば、タイマ111、121は、カウンタ値が0となったときに、割り込みを発生するとともにカウンタ値を初期化するものであってもよい。   In the above embodiment, the timers 111 and 121 generate an interrupt and initialize the counter value when the counter value underflows (when the counter value becomes a value further reduced by -1). However, the present invention is not limited to this as long as an interrupt is generated and the counter value is initialized when the countdown is performed to a predetermined value. For example, the timers 111 and 121 may generate an interrupt and initialize the counter value when the counter value becomes zero.

上記の実施の形態では、制御系(CPU)を2重化した2重系システムについて説明したが、3重系又は4重系等の2重化以外の多重系システムについても適用可能である。   In the above-described embodiment, the duplex system in which the control system (CPU) is duplexed has been described. However, the present invention can also be applied to a multiple system other than duplex such as a triple or quadruple system.

1 倒立二輪車
2 車輪
3 ステップカバー
4 ハンドル
10 制御装置
11、12 マイクロコントローラ
13、14、15、16 インバータ
17、18 モータ
19、20、21、22 回転角センサ
23、24 ジャイロセンサ
25、26 クロック生成回路
27、28 ステップSW
110、120 CPU
111、121 タイマ
DESCRIPTION OF SYMBOLS 1 Inverted motorcycle 2 Wheel 3 Step cover 4 Handle 10 Control apparatus 11, 12 Microcontroller 13, 14, 15, 16 Inverter 17, 18 Motor 19, 20, 21, 22 Rotation angle sensor 23, 24 Gyro sensor 25, 26 Clock generation Circuits 27 and 28 Step SW
110, 120 CPU
111, 121 timer

Claims (8)

制御に応じて移動する同軸二輪移動体であって、
第1のクロック信号を生成する第1のクロック生成部と、
第2のクロック信号を生成する第2のクロック生成部と、
前記第1のクロック信号に基づいて時間を計測する第1のタイマと、
前記第2のクロック信号に基づいて時間を計測する第2のタイマと、
前記第1のタイマが計測する時間に基づいて、前記同軸二輪移動体を制御する第1のCPUと、
前記第2のタイマが計測する時間に基づいて、前記同軸二輪移動体を制御する第2のCPUと、を備え、
前記第1のCPUは、第1の所定事象の検出時における前記第1のタイマの時間と、前記第1の所定事象よりも後に発生する第2の所定事象の検出時における前記第1のタイマの時間とに関する時間情報を前記第2のCPUに送信し、
前記第2のCPUは、前記第1のCPUから送信された時間情報から得られる前記第1の所定事象の検出時から前記第2の所定事象の検出時までの前記第1のタイマにおける経過時間と、前記第1の所定事象の検出時から前記第2の所定事象の検出時までの前記第2のタイマにおける経過時間との比率に基づいて、前記第2のタイマが計測する時間を前記第1のタイマで計測した場合における時間に補正する、
同軸二輪移動体。
A coaxial two-wheel moving body that moves according to control,
A first clock generator for generating a first clock signal;
A second clock generator for generating a second clock signal;
A first timer for measuring time based on the first clock signal;
A second timer for measuring time based on the second clock signal;
A first CPU for controlling the coaxial two-wheel moving body based on a time measured by the first timer;
A second CPU that controls the coaxial two-wheel moving body based on a time measured by the second timer;
The first CPU includes the time of the first timer at the time of detecting the first predetermined event and the first timer at the time of detecting the second predetermined event that occurs after the first predetermined event. Sending time information about the time of the second to the second CPU,
The second CPU is an elapsed time in the first timer from the time of detection of the first predetermined event to the time of detection of the second predetermined event obtained from the time information transmitted from the first CPU. And the time measured by the second timer based on the ratio of the elapsed time in the second timer from the time of detection of the first predetermined event to the time of detection of the second predetermined event. Correct to the time when measured by 1 timer,
Coaxial two-wheel moving body.
前記第1のタイマは、第1のカウンタを有し、前記時間の計測として、前記第1のクロック信号に基づいて前記第1のカウンタを初期値からの所定値までカウントダウンして割り込みを発生する動作を繰り返し、
前記第2のタイマは、第2のカウンタを有し、前記時間の計測として、前記第2のクロック信号に基づいて前記第2のカウンタを初期値からの所定値までカウントダウンして割り込みを発生する動作を繰り返し、
前記第1のCPUは、前記第1のタイマからの割り込みの発生に応じて動作して、前記同軸二輪移動体を制御し、
前記第2のCPUは、前記第2のタイマからの割り込みの発生に応じて動作して、前記同軸二輪移動体を制御し、
前記第1のタイマにおける経過時間は、前記第1のカウンタのカウント数であり、
前記第2のタイマにおける経過時間は、前記第2のカウンタのカウント数であり、
前記第2のCPUは、前記第2のタイマが計測する時間の補正として、前記第1のカウンタのカウント数と、前記第2のカウンタのカウント数との比率に基づいて、前記第1のカウンタを初期値から所定値までカウントダウンするまでの時間と、前記第2のカウンタを初期値から所定値までカウントダウンするまでの時間とが同一となるように、前記第2のカウンタの初期値を補正する、
請求項1に記載の同軸二輪移動体。
The first timer has a first counter, and counts the first counter to a predetermined value from an initial value based on the first clock signal to generate an interrupt as the time measurement. Repeat the action
The second timer has a second counter, and generates the interrupt by counting down the second counter from the initial value to a predetermined value based on the second clock signal as the time measurement. Repeat the action
The first CPU operates in response to the occurrence of an interrupt from the first timer to control the coaxial two-wheel moving body,
The second CPU operates in response to the occurrence of an interrupt from the second timer to control the coaxial two-wheel moving body,
The elapsed time in the first timer is the count number of the first counter,
The elapsed time in the second timer is the count number of the second counter,
The second CPU corrects the time measured by the second timer based on the ratio between the count number of the first counter and the count number of the second counter. The initial value of the second counter is corrected so that the time until the second counter is counted down from the initial value to the predetermined value is the same as the time until the second counter is counted down from the initial value to the predetermined value. ,
The coaxial two-wheel moving body according to claim 1.
前記第2のCPUは、さらに、前記第1のCPUから送信された時間情報の受信に応じて、前記第1のカウンタのカウント数と、前記第2のカウンタのカウント数との比率に基づいて、前記第2の所定事象の検出時から前記時間情報の受信時までの前記第2のカウンタのカウント数から、前記時間情報の受信時における前記第1のカウンタのカウンタ値を推定し、推定した前記第1のカウンタのカウンタ値に基づいたカウンタ値を、前記第2のカウンタに設定する、
請求項2に記載の同軸二輪移動体。
The second CPU is further configured based on a ratio between the count number of the first counter and the count number of the second counter in response to reception of the time information transmitted from the first CPU. The counter value of the first counter at the time of reception of the time information is estimated from the count number of the second counter from the time of detection of the second predetermined event to the time of reception of the time information. A counter value based on the counter value of the first counter is set in the second counter;
The coaxial two-wheel moving body according to claim 2.
前記第2のCPUは、所定の回数、前記第2のカウンタが前記補正後の初期値からの所定値までカウントダウンする毎に、前記第2のカウンタの補正後の初期値の実演算値と、前記第2のカウンタの補正後の初期値の実設定値との誤差の蓄積をカウント数として算出し、算出したカウント数で前記誤差の蓄積を打ち消すように前記実設定値を補正する、
請求項2又は3に記載の同軸二輪移動体。
Each time the second CPU counts down a predetermined number of times from the corrected initial value to a predetermined value, the second CPU calculates an actual value of the corrected initial value of the second counter; The accumulation of error with the actual setting value of the initial value after the correction of the second counter is calculated as a count number, and the actual setting value is corrected so as to cancel the accumulation of error with the calculated count number;
The coaxial two-wheel moving body according to claim 2 or 3.
前記同軸二輪移動体は、さらに、
搭乗者の一方の足が載置される第1のステップ部と、
前記搭乗者の他方の足が載置される第2のステップ部と、
前記第1のステップ部に対する足の載置を検出している場合に、当該足の載置を通知する第1のON信号を前記第1のCPU及び前記第2のCPUに出力する第1の検出部と、
前記第2のステップ部に対する足の載置を検出している場合に、当該足の載置を通知する第2のON信号を前記第1のCPU及び前記第2のCPUに出力する第2の検出部と、を備え、
前記第1のCPU及び前記第2のCPUは、前記第1の所定事象及び前記第2の所定事象のそれぞれとして、前記第1の検出部からの第1のON信号及び前記第2の検出部からの第2のON信号の出力の有無に基づいて、前記搭乗者の一方の足が載置されたこと、前記搭乗者の両方の足が載置されたこと、前記搭乗者の一方の足が載置されなくなったこと、及び、前記搭乗者の両方の足が載置されなくなったことのうち、いずれかの相互に異なる事象を検出する、
請求項1乃至4のいずれか1項に記載の同軸二輪移動体。
The coaxial two-wheeled vehicle further includes:
A first step portion on which one of the passenger's legs is placed;
A second step portion on which the other leg of the passenger is placed;
A first ON signal for notifying the placement of the foot when the placement of the foot on the first step unit is detected; the first CPU outputting the first ON signal to the first CPU and the second CPU; A detection unit;
A second ON signal for notifying the placement of the foot when the placement of the foot with respect to the second step unit is detected; outputting the second ON signal to the first CPU and the second CPU; A detection unit;
The first CPU and the second CPU have a first ON signal from the first detection unit and a second detection unit as the first predetermined event and the second predetermined event, respectively. On the basis of whether or not the second ON signal is output from the vehicle, that one of the passenger's feet has been placed, that both of the passenger's feet have been placed, and that one of the passenger's feet has been placed. Detecting any different event from the fact that the passenger is no longer placed and both feet of the passenger are no longer placed.
The coaxial two-wheel moving body according to any one of claims 1 to 4.
前記第1のCPU及び前記第2のCPUは、前記第1の所定事象として、前記搭乗者の一方の足が載置されたことを検出し、
前記第1のCPU及び前記第2のCPUは、前記第2の所定事象として、前記搭乗者の両方の足が載置されたことを検出し、
前記第1のCPU及び前記第2のCPUは、前記第1の検出部からの第1のON信号及び前記第2の検出部からの第2のON信号の出力の有無に基づいて、前記搭乗者の両方の足が載置されていること判定しているときに、前記同軸二輪移動体の制御を行う、
請求項5に記載の同軸二輪移動体。
The first CPU and the second CPU detect that the one foot of the occupant is placed as the first predetermined event,
The first CPU and the second CPU detect that both feet of the occupant are placed as the second predetermined event,
The first CPU and the second CPU are configured to perform the boarding based on presence / absence of output of a first ON signal from the first detection unit and a second ON signal from the second detection unit. When it is determined that both feet of the person are placed, control the coaxial two-wheeled vehicle,
The coaxial two-wheel moving body according to claim 5.
前記第1のCPU及び前記第2のCPUは、前記第1の所定事象として、前記搭乗者の一方の足が載置されなくなったことを検出し、
前記第1のCPU及び前記第2のCPUは、前記第2の所定事象として、前記搭乗者の両方の足が載置されなくなったことを検出し、
前記同軸二輪移動体は、前記搭乗者が搭乗していない場合に、前記同軸二輪移動体に対する操作に応じて、前記第1のCPU及び前記第2のCPUが前記同軸二輪移動体を制御する牽引モードを有する、
請求項5に記載の同軸二輪移動体。
The first CPU and the second CPU detect, as the first predetermined event, that one of the passenger's feet is no longer placed,
The first CPU and the second CPU detect that both feet of the occupant are no longer placed as the second predetermined event,
The coaxial two-wheel moving body is a traction device in which the first CPU and the second CPU control the coaxial two-wheel moving body in response to an operation on the coaxial two-wheel moving body when the passenger is not on board. Has a mode,
The coaxial two-wheel moving body according to claim 5.
第1のクロック信号によって第1のタイマが計測する時間に基づいて動作する第1のCPUと、第2のクロック信号によって第2のタイマが計測する時間に基づいて動作する第2のCPUとよって同軸二輪移動体を制御する制御方法あって、
前記第1のCPUが、第1の所定事象の検出時における前記第1のタイマの時間と、前記第1の所定事象よりも後に発生する第2の所定事象の検出時における前記第1のタイマの時間とに関する時間情報を前記第2のCPUに送信するステップと、
前記第2のCPUが、前記第1のCPUから送信された時間情報から得られる前記第1の所定事象の検出時から前記第2の所定事象の検出時までの前記第1のタイマにおける経過時間と、前記第1の所定事象の検出時から前記第2の所定事象の検出時までの前記第2のタイマにおける経過時間との比率に基づいて、前記第2のタイマが計測する時間を前記第1のタイマで計測した場合における時間に補正するステップと、
を備えた制御方法。
With a first CPU that operates based on the time measured by the first timer by the first clock signal, and a second CPU that operates based on the time measured by the second timer by the second clock signal There is a control method for controlling a coaxial two-wheel moving body,
The first CPU detects the time of the first timer at the time of detection of the first predetermined event and the first timer at the time of detection of the second predetermined event that occurs after the first predetermined event. Sending time information about the time to the second CPU;
Elapsed time in the first timer from the time of detection of the first predetermined event to the time of detection of the second predetermined event obtained by the second CPU from time information transmitted from the first CPU. And the time measured by the second timer based on the ratio of the elapsed time in the second timer from the time of detection of the first predetermined event to the time of detection of the second predetermined event. A step of correcting to the time when measured by one timer;
Control method with.
JP2012261135A 2012-11-29 2012-11-29 Coaxial two-wheel moving body and control method thereof Active JP5861622B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012261135A JP5861622B2 (en) 2012-11-29 2012-11-29 Coaxial two-wheel moving body and control method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012261135A JP5861622B2 (en) 2012-11-29 2012-11-29 Coaxial two-wheel moving body and control method thereof

Publications (2)

Publication Number Publication Date
JP2014104928A JP2014104928A (en) 2014-06-09
JP5861622B2 true JP5861622B2 (en) 2016-02-16

Family

ID=51026768

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012261135A Active JP5861622B2 (en) 2012-11-29 2012-11-29 Coaxial two-wheel moving body and control method thereof

Country Status (1)

Country Link
JP (1) JP5861622B2 (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01173255A (en) * 1987-12-28 1989-07-07 Fujitsu Ltd Synchronization method for multiple CPUs
CA2425148C (en) * 2000-10-13 2011-09-20 Deka Products Limited Partnership Control of a personal transporter
JP5676950B2 (en) * 2009-08-20 2015-02-25 キヤノン株式会社 Image forming apparatus
JP5310410B2 (en) * 2009-09-07 2013-10-09 トヨタ自動車株式会社 Coaxial motorcycle and control method thereof
JP5844038B2 (en) * 2010-11-15 2016-01-13 新電元工業株式会社 Electronic control device and control method of electronic control device

Also Published As

Publication number Publication date
JP2014104928A (en) 2014-06-09

Similar Documents

Publication Publication Date Title
JP5922586B2 (en) Motor drive control device
JP6545225B2 (en) Steering wheel unit
EP3061683B1 (en) Motor driving apparatus
EP3072797B1 (en) System for controlling a pedal assisted bicycle
JP5994607B2 (en) Coaxial two-wheel moving body and control method thereof
JP5904175B2 (en) Inverted two-wheel equipment
US20200083797A1 (en) Motor control device
JPWO2016047575A1 (en) Control device and control method for in-vehicle electronic device
JP2018052311A (en) Actuator system and abnormality detection device
JP5861622B2 (en) Coaxial two-wheel moving body and control method thereof
EP3388280B1 (en) Vehicle control system comprising synchronized control circuits
JP2019110723A (en) Control apparatus for electric power conversion system
JP5874616B2 (en) Mobile body and control method thereof
JP5267324B2 (en) Moving object, correction value calculation method, and program
JP5748126B2 (en) Synchronous control system
JP6326274B2 (en) Angular velocity detector
JP2005269879A (en) Control system
JP4678482B2 (en) Control device and electric power steering device provided with the same
JP5983457B2 (en) Inverted motorcycle and control method thereof
JP6197784B2 (en) Inverted moving body
JP5954213B2 (en) Mobile body and control method thereof
JP6079661B2 (en) Inverted moving body
JP3755435B2 (en) Crew restraint system
JP6183240B2 (en) Inverted motorcycle
JPS5852567A (en) Moving object speed calculation device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20141222

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20151112

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20151124

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20151207

R151 Written notification of patent or utility model registration

Ref document number: 5861622

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151