I'd like to minimize the energy consumption so I must minimize the Hamiltonian eqution to find the optimal solution, so I need a method which is't sensitive to the initial guess for the states and co-states?
If your system is linear, the LQG method, which is relatively simple, can help you; otherwise if the system is nonlinear, and/or if it is constrained, the Matlab software GPOPS, developed by Anil V. Rao, David Benson, et. al. is indeed a very good method. Other methods you may try include PROPT, RIOTS, NTG, etc.
If the system is nonlinear, Pseudo-spectral methods are the most efficient method in order to transfer your optimal control problem into a nonlinear optimization problem and then solve it with any nonlinear programming method such as SQP.
the software's such as GPOPS, PROPT and PSOPT are useful to use the PS optimal control method.
if your problem is not convex, any optimization method is sensitive to initial guess.