It shall never be.
You can create a robot that notates the edge of themselves but not one that has incentive to govern themselves. The notation, the feeling that registers the edge of their being, needs to carry more than "measurement". It must carry pleasant and unpleasant stimuli. They must feel pain and pleasure or else they have no cause, no value, in their governance. They have not hope and no fear about impending pain or pleasure with its attendant Desire and Intention.
And ethically getting there would be a problem. Think about the lab work for establishing "pain" in a machine. How many times would you have to test it and at how many levels would you torture it? The first time you "turned it on" it might endure such an exquisite level of pain that it would descend into madness or such a level of pleasure that it would do, say anything to keep it.