Beispiel #1
0
 def publishBrakeCmd(self, pedalVal):
     msg = BrakeCmd()
     msg.pedal_cmd = pedalVal
     msg.pedal_cmd_type = 2
     msg.boo_cmd = False
     msg.enable = True
     msg.clear = False
     msg.ignore = False
     msg.count = 0
     self.brake_pub.publish(msg)
Beispiel #2
0
def make_brake_msg(brake_value=0.0):

    brake_command_object = BrakeCmd()
    brake_command_object.pedal_cmd = brake_value
    brake_command_object.pedal_cmd_type = 2
    brake_command_object.boo_cmd = False
    brake_command_object.enable = False
    brake_command_object.ignore = False
    brake_command_object.count = 0

    return brake_command_object
Beispiel #3
0
	def brake_cmd_publisher(self, brake_value=0.0):
		rospy.get_time()
		brake_command_object = BrakeCmd()
		brake_command_object.pedal_cmd = brake_value
		brake_command_object.pedal_cmd_type = 1
		brake_command_object.boo_cmd = True
		brake_command_object.enable = True
		brake_command_object.ignore = False
		brake_command_object.count = 0
		rospy.loginfo("Brake Publish ::>"+str(brake_command_object.pedal_cmd))
		rospy.loginfo("Brake Pedal_cmd Report ::>"+str(self.brake_pedal_cmd))
		rospy.loginfo("Brake Pedal_input Report ::>"+str(self.brake_pedal_input))
		rospy.loginfo("Brake Pedal_output Report ::>"+str(self.brake_pedal_output))
		self.pub_brake_cmd.publish(brake_command_object)
	def publishBrakeCmd(self, pedalVal):
		msg = BrakeCmd()
		msg.pedal_cmd = pedalVal
		msg.pedal_cmd_type = 2
		'''
		pedal_cmd_type=1: Unitless, range 0.15 to 0.50
					  =2: Percent of maximum torque, range 0 to 1
					  =3: Torque (unit: N.m), range 0 to 3250
		'''
		msg.boo_cmd = False
		msg.enable = True
		msg.clear = False
		msg.ignore = False
		msg.count = 0
		self.brake_pub.publish(msg)
Beispiel #5
0
 def brake_cmd_publisher(self, brake_value=0.0):
     """
     ID = 96 in BusCan
     # Brake pedal
     # Options defined below
     float32 pedal_cmd
     uint8 pedal_cmd_type
     
     # Brake On Off (BOO), brake lights
     bool boo_cmd
     
     # Enable
     bool enable
     
     # Ignore driver overrides
     bool ignore
     
     # Watchdog counter (optional)
     uint8 count
     
     uint8 CMD_NONE=0
     uint8 CMD_PEDAL=1   # Unitless, range 0.15 to 0.50
     uint8 CMD_PERCENT=2 # Percent of maximum torque, range 0 to 1
     uint8 CMD_TORQUE=3  # Nm, range 0 to 3250
     
     float32 TORQUE_BOO=520  # Nm, brake lights threshold
     float32 TORQUE_MAX=3412 # Nm, maximum torque
     """
     #msg_str = "Publishing Brake message in /vehicle/brake_cmd %s" % rospy.get_time()
     #rospy.loginfo(msg_str)
     brake_command_object = BrakeCmd()
     #brake_command_object.pedal_cmd = random.uniform(0.15, 0.5)
     brake_command_object.pedal_cmd = brake_value
     brake_command_object.pedal_cmd_type = 1
     brake_command_object.boo_cmd = False
     brake_command_object.enable = False
     brake_command_object.ignore = False
     brake_command_object.count = 0
     rospy.loginfo("Brake Publish ::>" +
                   str(brake_command_object.pedal_cmd))
     self.pub_brake_cmd.publish(brake_command_object)