Trajectory Generation, Control, and Safety with Denoising Diffusion Probabilistic Models