Moving Robot Emulator and Control

80 views
Skip to first unread message

atılemre Cosgun

unread,
Feb 9, 2017, 4:48:43 AM2/9/17
to mitappinv...@googlegroups.com
Hi everybody, I want to make a moving robot emulator with MIT App Inventro2, but I dont know how can I make it. For example, there are 4 button on screen(up,down, left, right) and a moving bar. When I push forward buttons then will add screen forward icon. When I two times or many push forward buttons then will add screen forward icons as sequencly.Please help me.

SteveJG

unread,
Feb 9, 2017, 8:54:17 AM2/9/17
to mitappinv...@googlegroups.com
Here is Scott's example on how to make a joystick  https://groups.google.com/forum/#!msg/mitappinventortest/4VLUBlP1FxA/vLHlf3doAwAJ;context-place=searchin/mitappinventortest/joy$20stick%7Csort:relevance     This is not exactly what you want .

What have you tried?   What do you think the screen should look like?    A picture of what you want to do would help the people hfere to understand exactly what you want to do.

You probably could use a Canvas with spites to make the controls.   You say 'moving robot emulator' ...do you really mean you want to make an App that will move a 'robot' across your Android screen or do you want to actually control a robot?       This link might be very helpful in the former case 

Regards,
Steve


Ghica

unread,
Feb 9, 2017, 10:19:22 AM2/9/17
to MIT App Inventor Forum
Do you also want to control a real robot with your app? There are quite a few examples of that in the forum:
https://groups.google.com/forum/#!searchin/mitappinventortest/robot%7Csort:relevance
Cheers, Ghica.

Abraham Getzler

unread,
Feb 9, 2017, 11:34:05 AM2/9/17
to MIT App Inventor Forum

atılemre Cosgun

unread,
Feb 16, 2017, 5:06:33 AM2/16/17
to MIT App Inventor Forum
Thank you for interest. I exactly want to do like a at picture command system. Robot commands are entered via a set of on screen. Plan a route for robot and press the start then robot go on one by one according to the direction. 
The directions icons will appear on screen respectively when we press up-down-left-right buttons below side on picture. 
robot.jpg

atılemre Cosgun

unread,
Feb 16, 2017, 5:07:50 AM2/16/17
to MIT App Inventor Forum
robot.png

atılemre Cosgun

unread,
Feb 16, 2017, 5:12:24 AM2/16/17
to MIT App Inventor Forum
Yes I  want to control real robot with my app.

SteveJG

unread,
Feb 16, 2017, 8:47:17 AM2/16/17
to mitappinv...@googlegroups.com
How to control a robot using App Inventor   https://www.google.com/search?q=App+inventor+robot+control&oq=App+inventor+robot+control&aqs=chrome..69i57.7775j0j4&sourceid=chrome&ie=UTF-8  

What you do depends on what interface you use with your robot ... AI2 can only communicate directly with a Bluetooth enabled device, whether it is a LEGO gadget or something that works with a mini computer like an arduino.

You can use your interface design sketch.    You will need  four buttons for direction control;  a start button  and perhaps  5 Image controls perhaps in a Table arrangement (5 columns by 1 row) to use as a visual cue.

You will need  five png images to place in your visual cue.   An up arrow, a down arrow , a left arrow, a right arrow and a blank space. Initially all 5 images will have a blank.png image. These will need to be filled in the sequence the user pushes one of the four direction buttons.    Simply, this could work like this:  push up button, you add  the UP image to a List, add the next button and image until you get FIVE.  Then you have a list that might look something like:

Up.png
Down.png
Left.png
Right.png
Up.png

You will need code to send commands to the actual Robot which will be associated with the items in the List, so the robot first goes up, then down then left then right then Up  as many units as you require.

Have you started coding yet?    have you read http://www.appinventor.org/book2  so that you understand how AI2 blocks work?

The above is a suggestion.  There are many ways to do this. There are dozens of examples of robot contols in the MIT Gallery .... search for    robot.   Some of these might be very similar to what you want to do.

...and here is a tutorial to get you started perhaps  http://www.appinventor.org/bookChapters/chapter12.pdf  that has at least the for button elements of your project.  You will have to write the code to process the commands that will occur after pressing your START .... hint, these probably should be sequenced with the Clock.Timer control.

I edited the thread topic to Moving Robot Emulator and Control because you also want to control a robot.

Regards,
Steve

atılemre Cosgun

unread,
Feb 16, 2017, 1:53:28 PM2/16/17
to MIT App Inventor Forum
Thank you Steve, all of your write is usefull for me. My aim is remote control on my robot with bluetooth. Of course  I will use arduino, I know how I communicate to arduino and app.But I dont know how can I design an interface especially when I pushed direction buttons and  then add on the screen Up.png, Down.png, Left.png, Right.png, Up.png photos. I'm try to do your proposel. Thank you very much.

atılemre Cosgun

unread,
Feb 17, 2017, 12:45:37 PM2/17/17
to MIT App Inventor Forum
Hi Steve, I have tried to do my app according to the your proposel. I have achieved that pushed the direction buttons changed up,down,left,right arrows only one at list picrure. I couldnt achive how arrows will arranged.I add my desing.
robot_control.png

SteveJG

unread,
Feb 17, 2017, 3:25:51 PM2/17/17
to MIT App Inventor Forum
Very good start, nice graphics.  You need to use the Advanced Blocks to populate all the positions using the SetImage.Picture blocks.


After 'programming' the robot movement using the direction blocks pressed up to 5 times, START displays all the movements at once; "One Movement at a Time" displays the first and succeeding movements that are stored to a List one at a time.  The blocks to provide the actual commands are not fleshed out and they are grayed.  You need to provide the code their and decide where you want to send the commands.  Buttons 1-4 set up the robot movement list.  The Clear button clears the list and refreshes the image controls and labels.   A list of the images to be displayed is at the bottom of the screen.



Good luck with your Robot.  You have lots more work to do hooking this up to your Robot using Bluetooth.

--Steve

RobotControl.aia

atılemre Cosgun

unread,
Feb 18, 2017, 5:17:11 AM2/18/17
to MIT App Inventor Forum
Thank you very much Steve, I will finish my first app. thanks to your help.
Reply all
Reply to author
Forward
0 new messages