hello, I'm trying to make an application for pilot the drone with app inventor 2, i have need to create 2 joystick, one joystick for the direction and one for control altitude. I can't create a joystick for control altitude. please i need help for this, is for my project to sti2d.and i have need help allows for the program arduino who is connected with the app inventor 2
I don't know about drones. Do you need to control both joysticks at the same time?
yes, one for the direction to the drone and one for the altitude to te drone, and i need to my app inventor is connected with my Arduino
It will be difficult to do as it needed to be multi-touch detection. You can make one omni-directional joystic with the canvas component. Eg up-down is the height, right-left is the direction. You can then steer the drone in all directions without taking your finger off the screen.
What is the problem?
- you cannot create two joysticks
Here is an example showing how to make a 'joystick' with Buttons in a game Mountain Kingdom - a chat real time two player, two device game using the CloudDB and a Canvas. You could use two Button joysticks. - you need to interface the joysticks to the arduino
- something else.
What have you tried Enzo?
Essentially, you are trying to control a robot. Here are community discussions about controlling a robot https://community.appinventor.mit.edu/search?q=control%20robot using an arduino. They may help.
for now I made a joystick that handles the direction x and y and a slider that manages the altitude in z. now I would like to create an arduino program to allow me to control the engine of the drone or just an example by controlling LEDs to see if the principle works thanks to the value of the joysticks and slider, do you understand?
for now I made a joystick that handles the direction x and y and a slider that manages the altitude in z. now I would like to create an arduino program to allow me to control the engine of the drone or just an example by controlling LEDs to see if the principle works thanks to the value of the joysticks and slider, do you understand? can you help me ?
Look this:
Especially the last 4 items.
Hello @enzo.bonnin,
before going further : is the Arduino board flying with your drone ? If yes please take care that BT or WiFi do not allow to go much far. Or, if the Arduino is just a gateway to a powerful RF transmitter, have you thought about the "time lag" between the command sent by the phone to Arduino and then from the Arduino board to the drone ? This can cause a delay between command and actuation and this can lead to a very difficult control (oscillations).
Do you think to make a PID control in your Arduino ? I believe is better to think about that before discovering that you can loose your drone because it went out of control...
A car robot is much simpler to drive, it is slower and if it gets out of distance, it can stop itself autonomously. A drone cannot...it will crash on ground. Unless you plan to do a soft landing procedure on board. (but if it looses control while it is flying on water or on a road ? )
Anyway remember also that a big "mathematical" problem rises up when you handles the rotation : supposing that going streightforward is = 0 degrees, when you rotates to the right, you increases the heading of your drone up to 180 degrees (it will go then backward) always turning right, but when you reach 359,59, and you still rotate to the right, it returns to 0...
The same but the opposite sign, if you turn left.
In other words: your Arduino algorithm must be very clever to do everything very fast, in order to let your drone fly where you want that it goes...: you have to compose the speed vectors of the 4 (or 6) screws that your drone has, to make it fly in the direction that you want.
Sorry, I don't want to scare you, but have you thought on all this, before you get stuck in the middle of your project ?
Ciao, ugo.
.
http://ai2.appinventor.mit.edu/?locale=fr_FR#5212038306856960 is what you see my app app inventor in the link I put you there
It is not possible to link directly to the project in your ai2 account. You need to export the project as an aia file, then put it here.
My advice is to look for an arduino sketch on the arduino forums. Then come back with a ready sketch, we will help you adapt the app to this sketch.
Dear Enzo,
in attachment a (extremely) simple code to manage two sprites to behave like a double joystick. The clock tick is set to 10 ms so to acquire the new sprites (joysticks) positions as fast as possible. The code shows the new X's and Y's positions every 10 ms in 4 labels. Instead of simply showing the coordinates, to the same clock you can attach a sending (to Arduino) procedure.
But, after that, as @Patryk_F says, it's a matter of the Arduino code to do the rest of the job...
Best wishes.
Ugo.
Dual_Joystick.aia (399.5 KB)