#!/usr/bin/env python3

import os
import rospy
import time
from std_msgs.msg import String, Int8

# Shuts down the system when the vehicle is turned off

def on_ignition_switch(msg):
    if msg.data <= 2:
        rospy.logwarn("vehicle turned off, shutting down in 10 seconds")
        time.sleep(10)
        os.system("shutdown -h now")

if __name__ == "__main__":
    rospy.init_node('shutdown_node')

    sub_ignition_switch = rospy.Subscriber('/vehicle/ignition_switch', Int8, on_ignition_switch)
    pub_speak = rospy.Publisher('/sound/speak', String, queue_size = 1)

    rospy.spin()

6dc13eeb023522f351778764c2c4dc9b9b619975
<mask token>

<mask token>


def on_ignition_switch(msg):
    if msg.data <= 2:
        rospy.logwarn('vehicle turned off, shutting down in 10 seconds')
        time.sleep(10)
        os.system('shutdown -h now')


<mask token>

<mask token>


def on_ignition_switch(msg):
    if msg.data <= 2:
        rospy.logwarn('vehicle turned off, shutting down in 10 seconds')
        time.sleep(10)
        os.system('shutdown -h now')


if __name__ == '__main__':
    rospy.init_node('shutdown_node')
    sub_ignition_switch = rospy.Subscriber('/vehicle/ignition_switch', Int8,
        on_ignition_switch)
    pub_speak = rospy.Publisher('/sound/speak', String, queue_size=1)
    rospy.spin()

import os
import rospy
import time
from std_msgs.msg import String, Int8


def on_ignition_switch(msg):
    if msg.data <= 2:
        rospy.logwarn('vehicle turned off, shutting down in 10 seconds')
        time.sleep(10)
        os.system('shutdown -h now')


if __name__ == '__main__':
    rospy.init_node('shutdown_node')
    sub_ignition_switch = rospy.Subscriber('/vehicle/ignition_switch', Int8,
        on_ignition_switch)
    pub_speak = rospy.Publisher('/sound/speak', String, queue_size=1)
    rospy.spin()

#!/usr/bin/env python3

import os
import rospy
import time
from std_msgs.msg import String, Int8

# Shuts down the system when the vehicle is turned off

def on_ignition_switch(msg):
    if msg.data <= 2:
        rospy.logwarn("vehicle turned off, shutting down in 10 seconds")
        time.sleep(10)
        os.system("shutdown -h now")

if __name__ == "__main__":
    rospy.init_node('shutdown_node')

    sub_ignition_switch = rospy.Subscriber('/vehicle/ignition_switch', Int8, on_ignition_switch)
    pub_speak = rospy.Publisher('/sound/speak', String, queue_size = 1)

    rospy.spin()
