I want to add a reverse voltage protection diode (i'm using the 1N4001) to protect my robot from silly mistakes when connecting the battery terminals. But i also want to add a decoupling capacitor at the power supply. So, which setup should i use, A or B? And, why?
But actually, because the decoupling capacitors as a matter of definition, need to be at the circuit for which they are acting as a reservoir so that they can minimise the change in voltage when there is a sudden change in the current draw.
If they are any distance away, or indeed, on the other side of a resistor, diode or inductor (or a combination of those, including a length of wire which has resistance and inductance) then when the current changes suddenly, the voltage will change in proportion; that is exactly what the concept of "decoupling" is attempting to avoid.
Use two electrolytics back to back with twice the capacitance rating.
Put them in either location, preferably on the circuit side of the diode as per Paul_B.
It has to be because the diode itself will generate noise and if you put it in position A then the decoupling capacitors have no chance of removing that noise.