Asked

Joystick Control Only When Activated?

Hi,

i am playing around with the Joystick plugin in ARC on EZ-B v4, and it works really good with my old PS3 Controller. But, as i am programming something like an "Mars Rover", my robotic arm needs some parking position, and stay there without interaction. I want to press a button, or start a script, or advise the robot somehow to "activate robotic arm control", then he should switch to some AutoPosition (starting position) and then i get manual control via the Joystick plugin again, until i revert back to "parking position" and disable the Joystick Control.

For now, i havent found an option to enable/disable certain parts of the joystick plugin, so lets say #1 is disabled, but #2 is active or something. Do any of you know of a way, how to solve this?

Thanks alot!


Related Hardware EZ-B v4

ARC Pro

Upgrade to ARC Pro

ARC Pro is your gateway to a community of like-minded robot enthusiasts and professionals, all united by a passion for advanced robot programming.

PRO
Synthiam
#1  

Everything can be done with code:) You'll have to write some code to use the joysticks for their specific operations. A good place to start is to document exactly what you need and go from there. Breaking it down into specific requirements helps you know what it is that needs to be done

#2   — Edited

Thank you for your answer, DJ!

As far as i see, i can use the Variables in the Joystick plugin to build some code around it, to start and stop the joystick-usage when i want. I will need to play around with that to see how far i get:)

EDIT: I have tried to use the Variables, and clicked "Set EZ Script Variables" .  Then i wanted to control the X and Y Axis via Script, to see if this works, but i am afraid, it does not. I tried to "Set $JoystickX1 to 1"  or different values, and then i grabbed the current value to see if it works. This is working, so the variable get set correctly. But, the Servos dont move? As soon as i move my joystick axis, everything gets overwritten i think.

Please, can you point me in the right direction? First thing would be, how can i simple enable/disable the Joystick plugin from working (or specific axes) Second, how do you use the variables correctly, so i could maybe create scripts for "moving 20m front, then turn right" kind of stuff?

Maybe i am doing something wrong, any help welcome! Thx alot!

PRO
Synthiam
#3  

Setting a variable will hold a value, it won’t do anything.

I still don’t know what you’re attempting to do.

#4  

I want to be able to enable or disable the whole joystick control (or only lets say axis #1)

My current setup is a Playstation 3 Controller, Axis #1 is left analog stick, Axis #2 is right stick: Axis #1 X & Y controls a robotic arm with a gripper, which works fine Axis #2 X & Y controls the throttle & steering from an RC Car chassis (the robot sits on it)

I want to be able to deactivate Axis #1 control while i drive the car, and switch it back on later, when i need the gripper.

For now, as far as i found out, when i use the Joystick Plugin, it overwrites ALL Auto Positions. They do work, but after they are finished positioning the servos, it all revert back to the current Joystick Axis Value, so it does not make much sense to let the Robot Arm go to a parking position while driving, because it gets reactivated as soon as something touches the left stick on the controller:(

I hope this is clearer now. Here is a photo of the current prototype:

User-inserted image

PRO
Synthiam
#5  

The joystick doesn’t override anything to do with the auto position. The joystick moves the servos. The Auto Position also moves the servos. What you have are multiple controls moving servos at the same time

What you’d like to do is stop the joystick sometimes from moving servos?

you can use a script to do so. You’ll use the joystick position variable to move the servos. Essentially reproducing the functionality of the joystick to move servos.

and then you can turn on and off features of the joystick or change the function