2台による、もう少し複雑な動作です。

It is a little more complex motion by two.

2台で、もう少し複雑な動きをさせました。

引込線にも侵入させています。

あと、電車を追うように撮影してみました。

同じ動きを上から撮影したものが以下です。

ED79(赤いほうの車両)の動きも含めて全体がわかると思います。

import jarray

import jmri


class A_2dai(jmri.jmrit.automat.AbstractAutomaton) :


    def init(self):

        self.Sensor9 = sensors.provideSensor("9")

        self.Sensor8 = sensors.provideSensor("8")

        self.Sensor7 = sensors.provideSensor("7")

        self.Sensor6 = sensors.provideSensor("6")

        self.Sensor5 = sensors.provideSensor("5")

        self.Sensor4 = sensors.provideSensor("4")

        self.Sensor3 = sensors.provideSensor("3")

        self.Sensor2 = sensors.provideSensor("2")

        self.Sensor1 = sensors.provideSensor("1")

        self.throttle = self.getThrottle(5, True)  # address 5

        self.t2 = turnouts. provideTurnout("2") # point address 2

        self.t1 = turnouts. provideTurnout("1") # point address 1

       

        if (self.throttle == None) :

            print "Couldn't assign throttle!"

        return


    def handle(self):

        self.throttle = self.getThrottle(5, True)  # address 5

        self.t2.state = CLOSED # point straight

        self.waitMsec(500)

        self.t1.state = THROWN # point curve

        self.waitMsec(1000)


        self.throttle.setIsForward(True)

        self.throttle.speedSetting = 0.25

        self.waitSensorActive(self.Sensor4)

        self.t1.state = CLOSED # point straight

           

        self.throttle = self.getThrottle(3, True)  # address 3

        self.throttle.setIsForward(True)

        self.throttle.speedSetting = 0.28


        self.throttle = self.getThrottle(5, True)  # address 5

        self.waitSensorActive(self.Sensor5)

        self.waitMsec(1000)

        self.throttle.speedSetting = 0

        self.waitMsec(1500)


        self.throttle = self.getThrottle(3, True)  # address 3

        self.throttle.speedSetting = 0

        self.waitMsec(500)

        self.t2.state = THROWN # point curve

        self.waitMsec(500)

           

        self.throttle = self.getThrottle(5, True)  # address 5

        self.throttle.setIsForward(False)

        self.throttle.speedSetting = 0.25

        self.waitSensorActive(self.Sensor9)

        self.waitMsec(1200)

        self.throttle.speedSetting = 0

        self.t2.state = CLOSED # point straight


        self.throttle = self.getThrottle(3, True)  # address 3

        self.throttle.speedSetting = 0.28

        self.waitSensorActive(self.Sensor5)

        self.waitMsec(1500)


        self.t2.state = THROWN # point curve

        self.throttle = self.getThrottle(5, True)  # address 5

        self.throttle.setIsForward(True)

        self.throttle.speedSetting = 0.25


        self.throttle = self.getThrottle(3, True)  # address 3

        self.waitSensorActive(self.Sensor1)

        self.waitMsec(600)

        self.throttle.speedSetting = 0

        self.waitMsec(1000)

        self.t1.state = THROWN # point curve

           

        self.throttle = self.getThrottle(5, True)  # address 5

        self.waitSensorActive(self.Sensor4)


        self.t1.state = CLOSED # point straight

        self.throttle = self.getThrottle(3, True)  # address 3

        self.throttle.speedSetting = 0.28

        self.waitSensorActive(self.Sensor2)

        self.waitMsec(1000)

        self.t1.state = THROWN # point curve


        self.throttle = self.getThrottle(5, True)  # address 5

        self.waitSensorActive(self.Sensor7)

        self.waitMsec(700)

        self.throttle.speedSetting = 0


        self.t1.state = CLOSED # point straight

        self.throttle = self.getThrottle(3, True)  # address 3

        self.waitSensorActive(self.Sensor1)

        self.waitMsec(600)

        self.throttle.speedSetting = 0

        self.waitMsec(1000)



        return 1# to continue




        self.t1.state = THROWN # point curve

        self.t1.state = CLOSED # point straight

           

        self.t2.state = THROWN # point curve

        self.t2.state = CLOSED # point straight

           


# create one of these

a = A_2dai()


# set the name

a.setName("2dai script")


# and start it running

a.start()

スクリプトは以下のとおり。

車両の速度やウェイトを調整しながら画像の動きに持っていきました。