It's not quite the same problem that you're trying to solve, but in my old 23-foot sailboat's built-in cockpit storage lockers I had a wooden frame that was attached to the hull to which I used an X-shaped bungee/shock-cord arrangement with a hook at each end to hold down the gas tank - the center of the X went through the gas tank top handle, and the hooks at the ends of the tensioned cords were held in place in metal eyebolts attached to the wooden frame.
As for the battery, it was kept in a plastic battery box, and there was a strap that held the battery box down - the strap went through a hold-down bracket that was fiberglassed to the hull.
With the sailboat, the main concern was preventing movement of the battery or gas tank as the boat heeled, rather than the 'abrupt stop when braking the hauling vehicle' problem that you're trying to handle - but it's possible that the same concepts may be applicable to your case.