Skip to content

Commit

Permalink
WIP #4: Adjusted callback to call various sub functions
Browse files Browse the repository at this point in the history
This small change allows us to easily add additional callback sub-functions as we eventually assign more buttons to their respective control
  • Loading branch information
jasonlao99 committed Feb 1, 2019
1 parent 038a94b commit 457e0e8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions high_level_control/scripts/teleop_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,30 @@ 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)


# 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__':

Expand Down

0 comments on commit 457e0e8

Please sign in to comment.