예제 #1
0
from cannylive.msg import errorDistances

# topics:
publish_from_tx2_to_rio_name = 'control_to_rio'
subscibe_from_rio_to_tx2_name = 'read_rio'
subscribe_vehicle_settings = 'vehicle_settings'
subscribe_canny_name = 'errorDistances'
#publish_emstop_name = 'emergency_stop_internal'
publish_emstop_name = 'emergency_stop_external'

# Globals.
message_to_rio = to_rio()
message_from_rio = from_rio()
message_settings = vehicle_settings()
message_canny = errorDistances()
message_stop = stop()
message_from_terra = sensor_values()

# Create a publisher node so the rio can subsribe on the destinations.
tx2_to_rio_pub_handle = rospy.Publisher(publish_from_tx2_to_rio_name,
                                        data_class=to_rio,
                                        queue_size=1)
tx2_emstop_pub_handle = rospy.Publisher(publish_emstop_name,
                                        data_class=stop,
                                        queue_size=1)
#tx2_to_ext_pub_handle = rospy.Publisher(publish_vehicle_status, data_class=vehicle_status, queue_size=1)

# Create the nodes in the car.
rospy.init_node('tx2_main', anonymous=False)
update_rate = rospy.Rate(100)  #100hz
예제 #2
0
# Messages:
#   vehicle_emergency_stop:
#       int8 emergency_stop = 0
# -----------------------------------------

import rospy
import rosnode
from time import sleep
from ros_labview.msg import stop

# Settings:
stopExternal = 'emergency_stop_external'
stopInternal = 'emergency_stop_internal'

# Globals:
stopMsg = stop()
emStop = 0

# Create publisher
pubHandle = rospy.Publisher(stopInternal, data_class=stop, queue_size=1)
# Create subscriber
rospy.init_node(stopExternal, anonymous=False)
# Set refresh rate
updateRate = rospy.Rate(100)  #Hz


def readEmergencyStop(data):
    """Subscribes on the emergency stop value from the GUI PC
       Updates the global variable emStop for the publisher

    """