From 457e0e8ba7205f7d8e5d9b950554d11680eb8214 Mon Sep 17 00:00:00 2001 From: Jason Lao Date: Thu, 31 Jan 2019 19:50:24 -0600 Subject: [PATCH] WIP #4: Adjusted callback to call various sub functions This small change allows us to easily add additional callback sub-functions as we eventually assign more buttons to their respective control --- high_level_control/scripts/teleop_control.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/high_level_control/scripts/teleop_control.py b/high_level_control/scripts/teleop_control.py index 8ed6fc8..41196d4 100644 --- a/high_level_control/scripts/teleop_control.py +++ b/high_level_control/scripts/teleop_control.py @@ -41,6 +41,7 @@ def __init__(self): # Initialize publishers self.drive_pub = rospy.Publisher('drive_cmd', Twist) + # other publishers will be added when necessary # Initialize subscribers self.joy_sub = rospy.Subscriber("joy", Joy, self.joy_callback) @@ -48,11 +49,22 @@ def __init__(self): # Callback function for joystick controls def joy_callback(self, data): + self.set_drive_speed(data) + self.set_digging_mode(data) + + # Sets drive speed based on left joystick input + def set_drive_speed(self, data): twist = Twist() twist.linear.x = data.axes[1] twist.angular.z = data.axes[0] self.drive_pub.publish(twist) + # Sets digging mode based on ???? (TBD) + def set_digging_mode(self, data): + pass + + # additional functions TBD + if __name__ == '__main__':