2017년 4월 8일 토요일

Lego Mindstorms EV3 support


My son tried to connect Lego Mindstorms EV3 to AppInventor but kept getting errors on the android device.
Has anyone been successful in getting EV3 working with AI2?

If the support needs to be built, has anyone looked at what it would take? I tried looking at the documentation 
on the Mindstorms site but the Bluetooth Developer Kit still talks about the NXT and I cannot find
anything EV3 specific.

I would be interested in helping with any efforts towards this..

--
There's been a few queries and some good intentions to get something
built, but nothing has come out off it so far.
Let us know if you want to work on this.

--
Yes, I am interested to work on this. Does anyone have access to the EV3 bluetooth documentation?

--
I don't have any official documentation, but I was able to look at the code here https://legoev3.codeplex.com/SourceControl/latest (which is C#) to figure out the bluetooth api. I found the Lego.Ev3.Core code to be the most helpful.

Earlier this year, I was successful in using App Inventor's BluetoothClient component to talk to an EV3 and control motors and lights and read sensors. I've attached my project. There a global variable block named EV3, which is set to the bluetooth address of my EV3. That block is in the lower-right of all the blocks. You'll need to change it to your EV3's bluetooth address.

Thanks Liz. I will try it out.

--
This worked like a charm. 

Liz, are you planning to add this to the repository? If you need help with that, I would be happy to help.

--
Sure. Do you think it's good enough for people to use and learn from? I haven't really looked at it since April.

--
Well, it worked right out of the box. I  have not experimented with it much. Will write back as we try more.

--
Ideally, someone would update the Mindstorms components to enable support for EV3.  In the shorter term, I think that the App Inventor gallery might be the best place for Liz's project.

--
We should make the bluetooth address more configurable. Maybe use a ListPicker that shows all the paired devices. I could do that.

--
It needs to be in a place where Google can easily find it. Liz, would you be ok if I put it as a question on stack overflow? You can answer with a link to this discussion.

--
Google (and MIT) can easily find it on the Gallery ;-)

--
How about I fix the app so that it uses a ListPicker for the bluetooth address, then I put it on the Gallery, then Alok can put a question on stack overflow and I can answer (I've never answered a question on Stack Overflow before!) it with a link to the Gallery.

--
SGTM

--
Here's the updated project with the ListPicker for choosing the EV3 bluetooth address. Can you check it out before I put it on the Gallery?


--
Yes, it is working. I was able to pick up the EV3 from the list picker and connect after that. Tried the motors, LEDs and music. Everything worked as advertised :)

I will add a question to StackOverflow and send you a link.

--
I uploaded the app to the gallery and answered the question on stackoverflow.

--
Hi everybody, i have a question, i've been trying to use your app and i goes well, my EV3 appears in the list, i pick it and make connection, but when i try to move a motor or turn on a led or anything, the app gets stuck, can you tell me what´s happenning? is because of my phone? aby help i will be so greatful, 

--
I have started porting your app to native JAVA in the appinventor code base and have the LED commands working with my sandbox.

So a couple of questions/doubts:

1. I assume it is worthwhile to have support for EV3 in mainstream app.
2. If the answer to 1 is yes, how do I get my current code reviewed. Once I know that the basic structure/style is good, I can
implement the rest of the functionality.

--
That's fantastic!

I'm not sure what the answers to your questions are. I think Andrew McKinney is the best person to answer and/or coordinate.

--
Any ideas on who can help me with this..

--
You are in the right group for that kind of work. I would recommend writing a design proposal before writing more code, mostly because the technical part (wrapping the android SDK) is generally the easy part when you are creating a component. The most difficult part is to come up with a good API, as in, the set of blocks and properties for your component.
You can find sample design proposals in this forum, and you'll see how it generally goes back and forth with feedback and comments with other group members. Once that's sorted, it would be good for you to upload a test server and companion so others can play with it and feedback again, and the last step would be to open a pull request through GitHub. Please note that although the code is important, there are several other concerns to address before doing a code review. The code might be perfectly written and tested but the component might not align with project goals, so there's no guarantee that it will be added to the main branch. That's why having several rounds of feedback while you are designing new functionality is helpful to everyone, not only to component developers but also reviewers. Hope that does not discourage you. Looking forward to hearing about your progress!

--
Thanks for your comments. I will write a proposal.

--
Hello, thanks you for share the app :D:D.

Can you explain me how works this app?

I need to make one app that i can start one aplication in ev3 using bluetooth.

--
I downloaded the app onto my Samsung Note 4 and paired the robot. The app showed it but the interface did not work. I installed on a Galaxy Tab 4 and it worked like a charm. Very nice, comprehensive interface. Thanks Liz Looney.

--

Would you mind if I post your file to the AppInventor2 Gallery so it will be available to everyone. I am planning on using the code with my AppInventor2 class. Students will modify the code to have the robot perform a series of programmed tasks. Yours was the only program I have found so far for AppInventor2 and the EV3.

--
I don't mind it being in the gallery. Should I post it myself?

--
That would be great if you posted it. This is definitely something that would be of value to others. I am not sure if you can add tags so people can search for it under EV3, Mindstorm, Lego.

Let me know when you have posted it so I can let my colleagues know it is there.

--
I published it. Here's the link: ai2.appinventor.mit.edu/?galleryId=4694699086970880

This is my first published project, so let me know if it looks OK to you.

--
I bought an EV3 about 2 months ago. I am extremely novice in programing but I do work in IT field. I had searched for way to make .apk files for Android for EV3 that had features that I could not find on other apps out there. At least not for EV3. lots for NXT. So Anyway I came across your appinventor 2 resource for EV3 and it is awesome by the way. I was able to figure out how to make my own interface with your programming that showed buttons to go forward back, left, right , etc. Yours is great just overwhelming to novice like me. So now I have a basic driving interface as described and stop button, I can connect to EV3 via Bluetooth etc. What I was wondering is if you could help direct me how to make a button let's say that would play a .wav or .mp3 file on the EV3? So the file would have to be loaded on the EV3 somehow of course also. I believe the file has to be 8 bit and I can make those files. But how do you get the file on the EV3 and how do you find it/play it by pushing a button on the mobile device? it might be nice to have access to the phone (maybe I could figure that out) and pick sounds form the phone to load onto the EV3 and have it play the files out of the EV3 speakers (like when you use the Lego software).  To that end it would be nice to understand how to run a program already loaded on the EV3 (created and sent to EV3 from the lego commander app) from the mobile device. Again maybe a list picker to display programs on the EV3 to call up when needed. This way I could make the EV3 seem like it is interacting with the environment by having different things happen at the touch of a button on the mobile device. Maybe it is a tall order. But any guidance here would be appreciated. or add that to the app you made in inventor. I leave that up to your discretion :). Thanks again and what you have there is awesome.

--
I'm glad you were able to use my App Inventor 2 project to make your own app to control your EV3.

I don't know how to send a file to the EV3 from App Inventor, but once the sound file is on the EV3, I think you can play it with the following blocks:
To hook that up to a button and use the file entered in a textbox, use these blocks:
I haven't actually tried this, but I hope it works.

I don't know how to run a program already loaded on the EV3.

--
Oops. I forgot the value for SUBCMD_SOUND_PLAY.

--
I tried your app and it worked very well.
Thanks a lot. It helped me.
I added backward move and changed the buttons from click to touch down and touch up.
It also worked very good.

My question is:
Your app uses the buttons 1-4 to read the sensors but now I want to move the motors A-D after the robot touch (-Sensor) the wall.
I could not find a way to do it
Would you please help me in this?

--
I'm glad my app helped you. I don't currently have time to experiment with my EV3, but I think that you could use a Clock component's Timer event to periodically check the data from the touch sensor (using the readInputDevice procedure). If the value from the touch sensor indicates that the sensor is pressed, you can then activate the motors (using the outputPower procedure).

I hope this helps!

--
Thanks
I will try it

--
Thanks for making your code available. I just finished two weeks of Robot Wars with my students and it would not have been possible without your code. The students worked with your app and then made their own buttons to control the robot. We then had a series of competitions with the robots that the students loved - robot obstacle course, robot dance and best song. Here is a link to the robot page for the course.


Thanks again, this would not have been possible without your code.

--
I'm really glad your course was a success!

--

댓글 없음:

댓글 쓰기