Sloppy joystick control

I am using a small thumb joystick to control 2 continuous rotation servos with a maestro. I basically accomplished that but the joystick middle point is sloppy so it doesn’t always return to center and the servos continue to move. Is there anyway to create neutral minimums and maximums so the servos won’t start moving till they are reached to smooth out values from the sloppy pots and mechanics of the joystick?

Hello.

The Maestro does not have a built-in way to configure a dead zone like that from the Maestro Control Center. However, this is something you could probably do in your code. For example, you could have the analog feedback from your joysticks map to the neutral point if it is between some set range of values.

-Brandon

Thanks Brandon for getting back. It sounds good but some what over my head. I’m new to programming but learn fairly well from examples are there any you can point me at showing this?

Hi.

The examples given under the “Using an analog input to control servos” heading in the Example Scripts section of the Maestro User’s Guide would probably be helpful in setting up a dead zone with a Maestro script. The first example shows how to scale the analog input to a servo output, and the second example shows how to set different servo outputs for different ranges of inputs.

-Claire

I saw those examples and used the first to implement the joystick as controller for the servo. I just don’t get how to apply the second to creating a dead zone. Here is an example of script for a servo and pot pair I’m using. What would I add? I’m using continuous rotation servos if that matters. I set the 4 times to 1 to slow it down and set the 4000 value to 5500 which seemed to better match center of my servo pots neutral position.

  # Sets servo 0 to a position based on an analog input.
  1 get_position # get the value of the pot, 0-1023
  1 times 5500 plus # scale it to 64-4080, approximately 1-2 ms
  0 servo # set servo 0 based to the value

I combined those examples to make a script that would set a range of values to the neutral point for most servos. It might be a better starting point for you:

# Set the servo to 6000 if it is in the neutral range.  Otherwise scale it.
begin
  1 get_position    # get the value of the pot, 0-1023
  dup 460 greater_than
  if 
    dup 560 less_than
    if
      6000 # go to 6000 for values 460-560
      goto next
    endif
  endif
  dup 4 times 4000 plus # scale it to 4000-8092, approximately 1-2 ms

next: 0 servo
  drop     # remove the original copy of the pot value
repeat

I used the standard scaling for converting analog values to servo positions on the Maestro, though it looks like you tried a different scaling. You mentioned changing the offset value to better match your servo’s neutral point. Something you might also try is checking if your servo has a potentiometer for adjusting its neutral point.

-Claire