I would then gather, that the Battle of Gettyysburg, although premature from Lee's perspective, was an expected and desirable outcome of their march into Pennsylvania. He could not possibly had intended to continue on to Baltimore or Washington, unless the Union Army withdrew in that direction.
One would have to conclude that the campaign was a success from the Confederates' point of view. They were able to garner much needed supplies including thousands of head of cattle, they brought the war to the people of the North, and they dealt a serious blow to the Union Army. Serious enough that they were able to withdraw in an orderly fashion with little molestation.