Asked — Edited
Resolved Resolved by DJ Sures!

Joystick 2 Control Help

Im trying to get joystick 2 on the game controller to control rotation of the torso on my B9. I currently am controlling rotation by pressing button 4 for counterclockwise and button 2 for clockwise ( I have the commands PWM(D1, 4) for button 4 down and PWM(D1, 0) for button 4 up and PWM(D1, 11) for button 2 down and PWM(D1, 0 ) for button 2 up)

I have the diverse electronics controller connected with only one signal wire and I'm not really sure what mode it needs or is working in as I cannot find any documentation on it.

Experimenting with only the' X axis' Joystick 2 settings, when I assign it o digital port D1, I can get the torso to turn in either direction by changing the values in the 'min' and 'max' box but have no idea why or what its doing.

Anyone have any ideas on what may be happening and how I might set the 'min' and 'max' values to get the joystick to change the direction of rotation?

Would I need to use both the 'x axis' and 'y axis' maybe? I have no idea.

Im just trying to free up buttons so I can assign more MP3 options for this afternoon to interact with the tick or treaters.


ARC Pro

Upgrade to ARC Pro

Elevate your robot's capabilities to the next level with Synthiam ARC Pro, unlocking a world of possibilities in robot programming.

PRO
Synthiam
#1  

Can you be more specific on what you're asking?:)

#2  

What do the 'min' and 'max' values in the joystick control refer to? Any thoughts on how to set them to get the joystick to do what I describe doing above with buttons 2 and 4?

PRO
Synthiam
#3  

Can you screenshot what options you are referring too?

There are normally blue question marks everywhere to hover your cursor over. Perhaps I'm missing one of those on something important in the joystick control that no one has noticed yet.

#4  

I have buttons 2 and 4 currently configured as shown in the screencap and I would love to be able to have joystick 2 do the same job but not sure what the servo values mean or if that's possible without writing custom script.

Thanks

User-inserted image

User-inserted image

#6  

These are servo values where min=1 and max=180. You can look at it as degrees of servo movement... This is used when the joystick is controlling regular servos....

United Kingdom
#7  

Hi. Don't want to highjack this thread, but I have a question relating to joystick 2. Is there a way of changing the servo speed so when joystick 2 is fully pressed in any direction, the servos they are controlling don't turn at maximum speed?

I know that joystick 2 has variable speed positions (the harder you press, the faster the servos spin) but I want to limit the maximum speed, like you would do with the buttons setup that change speeds using servospeed() script, as joystick 2 doesn't seem to have the scripting option (not that I have seen anyway).

Any help on this would be greatly appreciated, as always. :)

Steve.

#8  

@Steve G...If you are talking about 360 deg servos then you would control speed via the modified servo movement panel....

United Kingdom
#9  

@Richard. Sorry, I should have said but forgot to mention it sleep. No, I meant 180 deg servos.

#10  

Try setting servo speed first in a script...


servo(D0,90)
servo(D1,90)
servoSpeed(D0,3) #speed value 0 - 10
servoSpeed(D1,3) #speed value 0 - 10
#etc...


United Kingdom
#11  

@Richard.

Thanks for that. I'll give it a try tomorrow morning. One question, may be a silly one, where abouts do I enter the servo speed script you supplied above, as I cannot see how or where to enter script in the joystick 2 setup screen when I click the gear icon?

#12  

@Steve G... Make a script called init... Make a point to run it at start up of your program... Or, what I do is use the script behind the connection control so it runs automatically when the ezb connects to ARC..

In this script you can set servo position, speed and set variables to default values as well.... etc

For the joystick script... Look at post# 5, second picture... This is where you would enter your button press script or scripts...

United Kingdom
#13  

Thanks @Richard. But the picture in post #5 is not relivent to what I'm asking as this is for scripting buttons, and not scripting joystick 2 (unless I'm misunderstanding something).

United Kingdom
#15  

Sorry, I think I might be confusing the issue with the 2 posts. confused. To recap, Hear I want to set a max speed on servos controlled by joystick 2.

User-inserted image

There is nothing on this page to enter scrips that I can see, only adjust "x" and "y" values.

The other post is regarding joystick buttons, not joystick 2.

User-inserted image

#16  

Yeah, ok.... you can't adjust speed there in the joystick control... You need to do that in a generic script that you run once (if you don't want to change the speed after that again)...

United Kingdom
#17  

Ok, thanks Richard. That sounds like what I'm after then, as I won't want to change the speed after the initial change, as I want to stay away from the maximum servo speed as it is to quick for what I need it for. So you know what I'm going to ask next, how and where do I do this?

#19  

Sorry for letting this go so long.

Not really resolved just haven't had time to try a couple thoughts based on this discussion.

Just wanted Joystick 2 to cause the same action I currently get with buttons 2 set to down = PWM(D1, 11) up = PWM(D1, 0) and button 4 set to down = PWM(D1, 4) up = PWM(D1, 0)