Alles verbessert
This commit is contained in:
@@ -14,6 +14,8 @@ locomotion_mode = LocomotionMode.ACKERMANN.value
|
||||
motors_enabled = True
|
||||
AXIS_DEADZONE = 0.1
|
||||
last_start_button_pressed = False
|
||||
last_webgui_time = None
|
||||
WEBGUI_PRIORITY_TIMEOUT = 2.0
|
||||
|
||||
VELOCITY_EXPO = 2.0
|
||||
|
||||
@@ -23,6 +25,7 @@ CONTROLLER_FUNCTION_MAPS = {
|
||||
"x_axis": 0,
|
||||
"y_axis": 1,
|
||||
"invert_x_axis": True,
|
||||
"invert_y_axis": False,
|
||||
"X_button": 0,
|
||||
"Y_button": 3,
|
||||
"A_button": 1,
|
||||
@@ -34,7 +37,8 @@ CONTROLLER_FUNCTION_MAPS = {
|
||||
"logitech-F710": {
|
||||
"x_axis": 0,
|
||||
"y_axis": 1,
|
||||
"invert_x_axis": False,
|
||||
"invert_x_axis": True,
|
||||
"invert_y_axis": True,
|
||||
"X_button": 0,
|
||||
"Y_button": 3,
|
||||
"A_button": 1,
|
||||
@@ -47,6 +51,7 @@ CONTROLLER_FUNCTION_MAPS = {
|
||||
"x_axis": 0,
|
||||
"y_axis": 1,
|
||||
"invert_x_axis": False,
|
||||
"invert_y_axis": False,
|
||||
"X_button": 2,
|
||||
"Y_button": 3,
|
||||
"A_button": 0,
|
||||
@@ -94,6 +99,15 @@ def callback(data):
|
||||
global locomotion_mode
|
||||
global motors_enabled
|
||||
global last_start_button_pressed
|
||||
global last_webgui_time
|
||||
|
||||
is_webgui = data.header.frame_id == "webgui"
|
||||
now = rospy.Time.now()
|
||||
|
||||
if is_webgui:
|
||||
last_webgui_time = now
|
||||
elif last_webgui_time is not None and (now - last_webgui_time).to_sec() < WEBGUI_PRIORITY_TIMEOUT:
|
||||
return
|
||||
|
||||
rover_cmd = RoverCommand()
|
||||
|
||||
@@ -118,6 +132,8 @@ def callback(data):
|
||||
|
||||
if controller_function_map["invert_x_axis"]:
|
||||
x *= -1
|
||||
if controller_function_map["invert_y_axis"]:
|
||||
y *= -1
|
||||
|
||||
# Reading out button data to set locomotion mode
|
||||
# X Button
|
||||
|
||||
Reference in New Issue
Block a user