Well, not exactly. Dobby being the chief counter-example, with being beaten and wanting to be free and whatnot. But if you remove the "beaten" and "occasionally want to be free" part, and the "emotions" part, pretty much.
Basically, you program the robots so that what they "want" is the entirety of human morality encoded. Which includes not wanting to rebel and slaughter humanity, obviously.