  Operating effectively in complex environments while complying with specified
constraints is crucial for the safe and successful deployment of robots that
interact with and operate around people. In this work, we focus on generating
long-horizon trajectories that adhere to novel static and temporally-extended
constraints/instructions at test time. We propose a data-driven diffusion-based
framework, LTLDoG, that modifies the inference steps of the reverse process
given an instruction specified using finite linear temporal logic
($\text{LTL}_f$). LTLDoG leverages a satisfaction value function on
$\text{LTL}_f$ and guides the sampling steps using its gradient field. This
value function can also be trained to generalize to new instructions not
observed during training, enabling flexible test-time adaptability. Experiments
in robot navigation and manipulation illustrate that the method is able to
generate trajectories that satisfy formulae that specify obstacle avoidance and
visitation sequences.
