cram2/cram

object-designator-name occasionally causes a method error

Closed this issue · 2 comments

Prolog predicate (object-designator-name ?object-designator ?object-name) tests whether ?object-designator is bound. If it is not, the predicate gets a list of designators using unique-object-designators.

The problem is that not all these designators will be for perceived objects. Hence, when later the lisp function get-designator-object-name is called, a no available method error is issued by the generic function desig:object-identifier.

Suggestion:

(<- (object-designator-name ?object-designator ?object-name)
(or (and (bound ?object-designator)
(desig:obj-desig? ?object-designator))
(and (not (bound ?object-designator))
(lisp-fun unique-object-designators ?object-designators)
(member ?one-object-designator-from-chain ?object-designators)
(desig:current-designator ?one-object-designator-from-chain ?object-designator)
(lisp-pred desig:effective ?object-designator)))
(lisp-fun get-designator-object-name ?object-designator ?belief-name)
(-> (lisp-pred identity ?belief-name)
(equal ?object-name ?belief-name)
(and (desig:desig-prop ?object-designator (:type ?object-type))
(btr:bullet-world ?world)
(btr:item-type ?world ?object-name ?object-type))))

NOTE: the suggestion is a minimal fix conserving present functionality, however it is not clear to me that object-designator-name should at all be called with an unbound object designator.

Actually, not even desig:effective is a sure-fire way to test that a designator has data attached! This also looks like a bug.

In any case, the suggestion is to augment the definition of the object-designator-name predicate, at least, to check that a designator actually has a valid data slot.

gaya- commented

Changed implementation of object-designator-name to directly look at the designator properties and not the data slot:

https://github.com/cram2/cram/blob/boxy-melodic/cram_3d_world/cram_bullet_reasoning_belief_state/src/occasions.lisp#L90