def makeStateEstimationSimulation(worldSM, verbose = False): """ Make a machine that simulates the state estimation process. It takes a state machine representing the world, at construction time. Let i be an input to the world machine. The input is fed into the world machine, generating (stochastically) an output, o. The (o, i) pair is fed into a state-estimator using worldSM as its model. The output of the state estimator is a belief state, b. The output of this entire composite machine is (b, (o, i)). @param worldSM: an instance of C{ssm.StochasticSM} @returns: a state machine that simulates the world and executes the state estimation process. """ return sm.Cascade(sm.Parallel(worldSM, sm.Wire()), sm.Parallel(StateEstimator(worldSM, verbose = verbose), sm.Wire()))
def systemSM(circuit, inComponents, motorNodes, initState): # circuit takes input which is a dictionary of values (or list of them) # output is a le.Solution instance. cSM = CircuitSM(circuit.components, inComponents, circuit.groundNode) # motor input is Solution instance, output is (vel, angle) motorSM = sm.Cascade(MotorAccel(initState, motorNodes), sm.R(initState)) # world has Solution as input, ((vel, angle), sol) as output wSM = sm.Parallel(motorSM, sm.Wire()) if inComponents: # there's another input besides motor feedback return Feedback2(sm.Cascade(cSM,wSM), MotorFeedback()) else: # only motor feedback return Feedback(sm.Cascade(cSM,wSM), MotorFeedback())