qwerty514 / EV3.c

A C library to progam your EV3
GNU General Public License v2.0
1 stars 0 forks source link

A general question... #1

Closed DJuego closed 8 years ago

DJuego commented 8 years ago

Hello qwerty514!

I am interested in an alternative to MonoBrick-Communication-Software (C#) and NXT++(NXT)

Do you plan to offer support for Windows (Visual Studio. MinGW...)? Do you plan to offer support for Wifi and Bluetooth? Which is the current state of the project?

Thanks!

qwerty514 commented 8 years ago

I'm currently busy with Robocup Junior, as I am part of the soccer (=> voetbal in Dutch) team of my high school, the Mendelcollege. You can see the repo here by the way: https://github.com/mendelcollege/NXT-Voetbal-2016/ When I'm (temporally) done with that (maybe april 2016, maybe july, depends on if we qualify for the world championship), I will be testing this library, as well as adding functionality and creating a wiki / guide / tutorial.

For NXT I would recommend to use the NXC language together with the BricxCC IDE, which has a built-in compiler: http://bricxcc.sourceforge.net/. NXC is a C based language, mixed with a little bit of C++ (references as arguments, inline functions), and built-in high-level and low-level functions to control your NXT. This is compiled to the same kind of bytecodes that the Robolab and NXT-G compilers would generate. These bytecodes are interpreted on a "virtual machine" that is running on the NXT. Technically you would therefore not need any special firmware for the NXT, like leJOS, as long as you configure the compiler / BrixCC correctly. However, if you want to use all the functionality of NXC, it is strongly recommended that you use the "Enhanced Firmware", which comes with BricxCC (and which you can download to the robot with BricxCC). NXC tutorial: http://bricxcc.sourceforge.net/nbc/nxcdoc/NXC_tutorial.pdf NXC guide (more like a database): http://bricxcc.sourceforge.net/nbc/nxcdoc/nxcapi/

The latest preview version of BricxCC has support for EV3 (partly). NXC does NOT. Sadly, the development of BricxCC has been abandoned for unknown reasons. (There are no updates since 2013). In a forum post the author of BricxCC mentioned that he considered making an NXC for EV3, EVC (with a new compiler which generates bytecodes for EV3), but it seems that this won't happen.

Normal EV3 programs (compiled by the Mindstorms IDE) work fundamentally the same as NXT programs: Bytecodes, which a "virtual machine" interprets. The VM then controls device drivers to do stuff. You can read more about it by reading all the development kit pdf's, and looking at the source code of the virtual machine, which is, like the development kits, downloadable at the Mindstorms website. One thing, however, that is fundamentally different, is that the EV3 runs on Linux as a base, so you could compile C programs for ARM Linux, and if you can interact with the drivers / VM, you can use native C, (instead of nxc, which is compiled to bytecodes), to program your EV3. You can find instructions for that on http://robotnav.com/. The point of EV3.c is to make it more easy by making an easy-to-use library with simple functions, so that everyone can use it, while at the same time being very powerful. Additionally, you do not need special firmware. It is not done yet.

The latest test release of BricxCC does support using the arm compiler mentioned by robotnav.com, and downloading programs to the EV3 (through USB), as well as other BricxCC tools support. The author (John Hansen) was also busy writing a library like EV3.c, called the "LMS API", named after the virtual machine on the EV3, which is called LMS (http://www.legomindstormsrobots.com/lego-mindstorms-ev3/programming-ev3-c-bricxcc/). Sadly there is no sensor support at the moment and this too seems to be abandoned. Someone else also created the EV3 IDE (http://jasvap.somee.com/ , http://www.thenxtstep.com/2014/08/programming-ev3-in-ansi-c.html), with which you can download programs to your EV3. However, you still need install the compiler mentioned on robotnav.com and use its hardware interaction techniques, or EV3.c.

I am considering writing a plug-in for an IDE (maybe Netbeans, Eclipse, Visual Studio?), but for that I would need a lot more programming skills. I will try to add wifi, bluetooth and usb support. (for brick to brick communication?) Note that the purpose is to run on the EV3, not on a computer that controls the EV3 (which is something entirely different). Therefore there will be no MinGW support, as it's a C to windows x86 compiler.

I hope this has answered your questions, be free to ask more. I also recommend to read the developer kits, as there is much information of great value in them.

Kind Regards, Bram Mak Robotics Enthusiast at Mendelcollege in the Netherlands

PS, if you can help or have cool ideas, I would greatly appreciate them!

DJuego commented 8 years ago

Thank you for your very extended answer! Astonishing! Delighted to know that your project keeps on. I knew a good share of that information. However your answer has unknow links for me. Thanks! I missed any mention to the ev3dev project.

Note that the purpose is to run on the EV3, not on a computer that controls the EV3 (which is something entirely different)

Actually, in my current case, I am trying to control the EV3 brick from PC with Windows 10, C++ and the official firmware :-) That's the reason why I took notice of your repository.

Good luck for you and for your team, Bram!

qwerty514 commented 8 years ago

For that purpose, I recommend looking at the Firmware and Communication Development kits by Lego; It has all the possible op-codes written down and an extended description of the communication protocol. You could, if you have the time, even write your own library.