OpenRoberta / openroberta-lab

The programming environment »Open Roberta Lab« by Fraunhofer IAIS enables children and adolescents to program robots. A variety of different programming blocks are provided to program motors and sensors of the robot. Open Roberta Lab uses an approach of graphical programming so that beginners can seamlessly start coding. As a cloud-based application, the platform can be used without prior installation of specific software but runs in any popular browser, independent of operating system and device.
Apache License 2.0
124 stars 121 forks source link

Add HTTP as a communication protocol to share messages between EV3s (and maybe other robots) #72

Open simonedegiacomi opened 5 years ago

simonedegiacomi commented 5 years ago

Is your feature request related to a problem? Please describe. I think that robotic projects where more robots and devices talks together are the most intriguing ones. But one problem is that the communication methods offered by the blocks is often limited to bluetooth. This is okay if we want a simple communcation between a small number of robots, but it's not sufficient when the number incrases or we add other kind of devices (like Raspberry).

Describe the solution you'd like One of the solutions that came to my mind is to use HTTP to share message using two blocks:

To simplify things further it would be possible to choose a fixed port and remove it from the block arguments, leaving there only the hostname (or ip) and the path. The url parameter could be used to select the target robot and the path could be used as a subject/channel of the message.

Additional context I'm part of an association that teaches children the basics of programming using robots and sometimes we present projects in fairs. Our last one included 6 EV3s and a Raspberry, the configuration was the following:

All the connections were based on bluetooth: controllers were paired to the relative robot and each robot was connected to the raspberry. The programs were written using the official graphical language. This worked, but it wasn't very reliable: sometimes one of the robot disconnected, went out of range or the received message was corrupted. If we were usign HTTP over WIFI we could have setup an access point and connected all the robots to it, and then configure the blocks with the right urls. Some advantages of this approach are:

Here's a possible example of programs to send a message from the robot A to B: Program of robot A (controller): immagine

Program of robot B (player):

immagine

Proof of concept I tried to implement a proof of concept and I have a working solution for the EV3 (using leJOS). The code of my example needs refactor because currently it adds the http functionality to the bluetooth blocks (which I renamed to "CommunicationSend" and "CommunicationReceive"): the biggest disadvantage of this is that now there is code related to http also for robots that doesn't have WIFI. Clearly, if OpenRoberta is interested in this feature it is necessary to design and define the details better.

Anyway, you can try my proof of concept using the following branches:

https://github.com/simonedegiacomi/robertalab/tree/http-messages https://github.com/simonedegiacomi/robertalab-ev3lejos-v1/tree/http-messages https://github.com/simonedegiacomi/blockly/tree/http-messages

ensonic commented 5 years ago

@simonedegiacomi I like the idea. I don't like the url parameters though. This would make it hard to use for kids.

If the robots would be connected to the internet anyway we could use a group chat protocol that is run by the server. Then all messages would go through the server. This would then not require any use, just a group-name.

An alternative to using the server would be a peer to peer chat protocol (like https://en.wikipedia.org/wiki/Tox_(protocol)) if we can find libraries for the ev3.

In any case we'd need a way to configure a chat-group name (in the robot config) and maybe an invite code (when using the server). Also ideally we could configure the robots name in the configuration.