Skip to content

Commit

Permalink
WIP #4: Created publisher, subscriber, and callback function for drive
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonlao99 committed Jan 26, 2019
1 parent 6b38d3b commit af7557a
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions high_level_control/scripts/teleop_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,37 @@
from geometry_msgs.msg import Twist
from sensor_msgs.msg import Joy

class TeleopController:
#stuff
class TeleopControl:

# Constructor
def __init__(self):

# Initialize publishers
self.drive_pub = rospy.Publisher('drive_cmd', Twist)

# Initialize subscribers
self.joy_sub = rospy.Subscriber("joy", Joy, self.joy_callback)


# Callback function for joystick controls
def joy_callback(self, data):
twist = Twist()
twist.linear.x = data.axes[1]
twist.angular.z = data.axes[0]
self.drive_pub.publish(twist)


if __name__ = '__main__':
#stuff

# Initialize as ROS node
rospy.init_node('teleop_control')

# Create a TeleopControl object
control = TeleopControl()

# Ready to go
rospy.loginfo("Teleop Control initialized...")

# Loop continuously
while not rospy.is_shutdown():
pass

0 comments on commit af7557a

Please sign in to comment.