If you're actually a programmer I'm curious as to how you approach your own work because your logic is very flawed.
If your supposed AI can't avoid an obstacle it's clearly not going to be in a position where it would have any chance of harming anyone. Just like you don't take a new car straight out of the factory without any brake fluid and expect it to stop, you don't take a bunch of code of AI and put it straight into working environment. There is insane amounts of planning and testing involved with developing any type of AI, and that will be even more severe with one that has a any potential of harming anyone.
If you presented a problem that is at least slightly debatable that would be an interesting topic, but preventing a robot from stepping on a child really is just basics of AI programming and I'm surprised you can't wrap your head around it considering your professional claims.
my logic for that situation is based on this video: https://www.youtube.com/watch?v=3TYT1QfdfsM
as for the second part, that was only an example, i created this thread for the general threat, not that single situation.
Ok I managed to watch that video for 10 minutes and was about to kill myself.
"Robot goes to fetch you a coffee but then there's a kid in its way so you rush to hit the killswitch but then the robot fights you because that'd interrupt him from fetching you coffee" - sorry, what? We already have working car autopilots that don't (usually) run over people in 2018 but future AI-having robots won't have simplest infrared cameras to see obstacles in front of them and would require a killswitch not to destroy everything on their path? Also it'd fight you, the owner? That's ridiculous.
It's generally painful to watch, everything he's covered in that 10-minute bit has been resolved years ago. It'd be somewhat okay if AI development basics were under discussion here - but obviously not its future and/or possible threats.