When I use prog.AddConstraint, I not only want provide what constraint is, I also want to provide the gradient of this constraint.
I do not want solve to help me to calculate the gradient, I want do it by myself, can I do that???
By default, Drake will do automatic differentiation on your constraint function. If you do not want automatic differentiation, you could provide customized gradient. We have a tutorial https://github.com/RobotLocomotion/drake/blob/master/tutorials/custom_gradients.ipynb, and you can refer to the stackoverflow answer /a/61523955/1973861