Panasonic has agreed to help set up the factory that Tesla Motors plans to build for making batteries for Tesla and other electric cars.