Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASTController unexpectedly invalidates a valid input #162

Open
jefft0 opened this issue May 30, 2021 · 0 comments
Open

ASTController unexpectedly invalidates a valid input #162

jefft0 opened this issue May 30, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@jefft0
Copy link
Collaborator

jefft0 commented May 30, 2021

Use case: In frame 300ms, there is model for a grab command which predicts h attached s in the next frame:

 (fact (pred (fact (mk.val h attached s) 0s:400ms:0us 0s:500ms:0us)))

As usual, a prediction monitor is created for this prediction. Because the preconditions were not met in frame 300ms, the grab command fails

In the next frame 400ms, the preconditions change and now the grab command can succeed. The model for grab command executes, and at the beginning of the next frame (500ms) we have the new fact which is injected by the auto-focus controller.

fact1:(fact (mk.val h attached s) 0s:500ms:0us 0s:600ms:0us)

The auto-focus controller also creates an ASTController to monitor this one fact.

Also in frame 500ms, the prediction monitor for the original prediction fires (at the end of its predicted time interval starting at 400ms). Because the original grab command didn't succeed, it correctly injects the following anti-fact:

anti_fact1:(|fact (mk.val h attached s) 0s:400ms:0us 0s:500ms:0us)

The problem is that when this is injected, it is an input to the ASTController created for fact1 where the following code invalidates all facts which match its value. (In this case, input is anti_fact1 and target_ is the target of the ASTController, fact1.)

switch (input->is_timeless_evidence(target_)) {
case MATCH_SUCCESS_NEGATIVE:
  kill();
  tpx_->signal(v);
  target_->invalidate()
  break;

As the name implies, the method is_timeless_evidence only matches the values, regardless of the time intervals. Even though anti_fact1 is for frame 400ms, this code invalidates fact1 which is for frame 500ms. Any following operations which need it will fail because it has been invalidated.

The ASTController invalidates the fact, which doesn't seem right. But what is an ASTController? Here is the description: "Atomic state controller. Attached to a null-pgm and monitoring to a (repeated) input fact (SYNC_PERIODIC or SYNC_HOLD). Upon catching a counter-evidence, signal the TPX and kill the object (i.e. invalidate and kill views); this will kill the controller and TPX."

A change targeted pattern extractor (CTPX) accumulates inputs over several frames. The ASTController seems to be part of the mechanism to prevent a CTPX from using an input it has already stored if a new input is counter-evidence. That is reasonable. But it doesn't seem right to invalidate the input from being used for other purposes.

I created this issue so that we can discuss solutions. One solution is that the CTPX should store a copy of the input and only that copy is invalidated. Or perhaps the CTPX can be invalidated without invalidating its inputs.

@jefft0 jefft0 added the bug Something isn't working label May 30, 2021
@jefft0 jefft0 added this to the diag_mode_rel_0_1 milestone May 30, 2021
@jefft0 jefft0 removed this from the diag_mode_rel_0_1 milestone Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant