Hi,
I could not figure out that why you have used global variables ctrl_c, twist_object and pub of shutdownhook() function in publisher node because they are not used, are they? Can you please elaborate why are they defined inside this function? Thanks in advance.
def shutdownhook():
# works better than the rospy.is_shut_down()
global ctrl_c
global twist_object
global pub
rospy.loginfo("shutdown time!")
ctrl_c = True
cmd_publisher_object.move_robot(direction="stop")