Controlling kobuki robot

I am unable to stop the robot by pressing Ctrl+C in shell.

Hi, welcome to the community!

That’s because the controller is left with the last velocity command you sent to the robot. You need a shutdown hook for that: