Exemple #1
0
    def __init__(self):
        rospy.init_node('controller')
        self.goal = False
        self.sendman = sender()
        self.twist = Twist()
        self.last_twist = Twist()
        self.action_count = 0

        print('node started')

        rospy.Subscriber("twitch", Twist, self.callback)
        rospy.Subscriber("if_goal", Bool, self.is_goal)
        rospy.spin()
    def __init__(self):
        rospy.init_node('controller')
        self.goal = False
        self.sendman = sender()
        self.twist = Twist()
        self.action_count = 0
        self.plus = 0
        self.minus = 0
        self.j = self.create_zero_twist()

        print('node started')

        rospy.Subscriber("twitch", Twist, self.callback)
        rospy.Subscriber("if_goal", Bool, self.is_goal)
        rospy.Subscriber("Emergency", Bool, self.is_Emergency)
        rospy.spin()
Exemple #3
0
speed_ratio_l = 0  # To slow down linear velocity smoothly
speed_ratio_a = 0  # To slow down angular velocity smoothly
pre_linear_v = 0  # Record previous motion
pre_angular_v = 0  # Record previous motion
full_speed = 0.5  # Highest speed

pygame.init()
# Loop until the user clicks the close button.
done = False
# Used to manage how fast the screen updates.
clock = pygame.time.Clock()
# Initialize the joysticks.
pygame.joystick.init()

sendman = sender()

# -------- Main Program Loop -----------
while not done:
    joystick = pygame.joystick.Joystick(0)
    joystick.init()
    # create message
    j = {
        'linear_x': 0.0,
        'linear_y': 0.0,
        'linear_z': 0.0,
        'angular_x': 0.0,
        'angular_y': 0.0,
        'angular_z': 0.0,
    }