KTH-SML / ltl_automaton_core

7 stars 4 forks source link

Bug when using TS state of 1 dimension #3

Closed RBinsonB closed 3 years ago

RBinsonB commented 3 years ago

When using only one TS state model (2d region pose for example), TS state received by the LTL planner (planner.py of ltl_automaton_planner) is not recognized as either part of the TS or as previous state. It probably as something to do with the variable format.

RBinsonB commented 3 years ago

Bug seems to be linked with the initial state format. If first TS state is same as initial state, it is not recognized. Happens with more than one dimension as well.

RBinsonB commented 3 years ago

The initial state format can be solve by extracting the only value in the 'initiale' set of the product:

# Get first value from set
self.curr_ts_state = list(self.ltl_planner.product.graph['ts'].graph['initial'])[0]

For the 1-dimension issue, it seems that the product doesn't form tuples from one value and the nodes list is a list of string. The following snippet can solve the issue:

        # Get system state, convert to tuple and set boolean condition to False
        if len(msg.states) > 1:
            state = tuple(msg.states)
        else:
            state = msg.states[0]
RBinsonB commented 3 years ago

Fixed by implemented suggested changes in ba21c0bc626d1d29f696ad62e933a98508e95369