Need Help - New to leJOS and doing a company project

Post your EV3 projects, project ideas, etc here!

Moderators: roger, gloomyandy, skoehler

eoinlavery
New User
Posts: 1
Joined: Thu Sep 07, 2017 2:36 pm

Need Help - New to leJOS and doing a company project

Postby eoinlavery » Thu Sep 07, 2017 2:46 pm

Good afternoon,

I have previously used Mindstorms NXT and EV3, but never within the context of leJOS, just used the built in firmware and software. The capabilities I have seen thus far from leJOS and the research I have already done makes it seem like an incredible platform for automation, and I am excited (but struggling) to get into it.

We are undertaking a new project and need to create an automated lego Bucket Wheel Excavator model. The model is built, motors and EV3 brick attached to the model, and leJOS loaded onto the EV3, connected to a PC via Bluetooth. I have been able to connect to it and compile and send the program to the EV3 (a simple Hello, World! program.)

However, our end goal is to be able to have a GUI on a PC, allowing us to click on GUI buttons to activate different motors (Sometimes more than one motor at any given time.) Whilst the motors are moving, we would like to receive feedback from the motors as to how many rotations they have done, and update this value into a database. (The data itself will be displayed on a separate PC, it is just the collection and uploading of the data we need.)

Can anyone give me any pointers for how to get started with these steps? I am somewhat familiar with Java so I'm not totally new to programming, just completely new to leJOS and have been given a rather tight deadline to work with.

To summarise, we need:
    Remotely control motors from a PC program.
    PC Program to have a GUI, with buttons that control motors when clicked.
    EV3 brick to feedback to PC the number of rotations on each motor while the program is running.
    Program to upload data to a database. (I have used JDBC in the past, so I am familiar with this part.)

If anyone can help me out either on this post or in a personal message I would very much appreciate it.

Thank you!

User avatar
gloomyandy
leJOS Team Member
Posts: 5914
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Need Help - New to leJOS and doing a company project

Postby gloomyandy » Thu Sep 07, 2017 3:26 pm

Hi,
if you are familiar with Java then spend some time looking at the many tutorials out there that cover building GUI programs, that will show you how to complete that part of your project. Then spend some time understanding how networking works with Java, this will show you how to allow your PC based GUI program to talk to an EV3 based program, which will allow you to send status messages and commands between the two. All of the above is just standard Java and nothing is unique to leJOS. Forget for now controlling motors etc. Just learn how to handle the comms, have the GUI send messages in response to a button, or even better send the value from a GUI slider control to the EV3. Have the EV3 display the value on the screen. Then consider having the EV3 do something very simple like periodically report the state of the EV3 battery to the PC program and display that value in your GUI. Once you have this much working you should be able to progress to having the PC send some sort of high level motor command (do not be tempted to use low level motor commands, do the "real time" stuff on the EV3), so for instance a command to start the bucket rotating at a certain speed, or to move the boom, or whatever. Add mechanisms for the EV3 to be able to report what is happening with the motors (current position etc.) and you are almost there.

Personally I find studying source code a good way to learn. If that works for you take a look at the following...
https://lejosnews.wordpress.com/2017/07/15/slam/
This project is pretty advanced but uses essentially the same sort of model that you want to make use of (most of my advanced projects do this), with a PC side program sending high level commands to an EV3 program that handles the real time control elements. The above article contains a link to the github repo that contains all of the source code. Note that this code is pretty rough and ready and is probably not the best way to do many things, but it may give you some help.
leJOS news https://lejosnews.wordpress.com/


Return to “EV3 Projects”

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest