Added heartbeat logic

heartbeat frequency is based on distance of a specific object.