Relax. Relax. Relax.
Our autonomic nervous system is divided into the sympathetic and parasympathetic, the parasympathetic is responsible for conserving energy, relaxing, resting, and erections (but not ejaculations, that's sympathetic.) Erections are actually caused by the the relaxing of your penis, it get's relaxed and blood can flow into it. If youre activating the sympathetic by being nervous or tense you make it impossible to get an erection, impossible for the blood to get there. The vagus nerve (the 10th cranial nerve) is partly responsible for regulating heartrate, breathing, etc. So if you concentrate on your breathing and slow it down, it should help.