Could grpc be fed with a simple file-descriptor and we can deal with
things around it ? In the end, it id just protocol buffers over some
socket, so maybe we can simulate that indpenednelty.
>
> So these are the choices imho
> a) we go multithread
> b) we use select with 0 timeout, (and asyncNext) but in this way we will not
> exploit anyhow the interrupts
> c) we instantiate multiple servers, a udp server for streaming position a
> tcp one for sending commands and another one to send pure gcode.
As Hartley said, (c) implies (a). which then means, that we have to do
some possibly annoying mutex locking of things.
We could multiplex servers with some event mechanism which multiplexes
using select() or poll(). That would also be able to deal with the
interrupt from the queue.
> do you have other options to add?
> If not what do you suggest? I personally prefer the last one.
In general, I'd try to avoid going with threads that meddle with the
same data - here we would have one thread putting stuff into the queue
and another thread figuring out what the current queue status and
position is while it needs to lock elements that are needed by both.
So thinking about strategies that makes sure that different threads
operate on different data with only minimal communication (message
queue or something) would be good. Given that we only have one core,
multiple threads don't necessarily buy anything.
I am not opposed to threads in general, but only if other options are
too nasty; so exploring the async stuff
I started an explorative branch "event-reading" for this
(
https://github.com/hzeller/beagleg/tree/event-reading)
These are the first steps, hacked together quickly; Right now, it does
not do anything with the actual reading from the stream yet, but it
starts the loop in main() and operates the connecting server. And
TODOs in gcode-parser.h mentioning the next steps.
-h
>
> -l
>
>
> Il giorno venerdì 8 luglio 2016 13:16:40 UTC+2, Leonardo Romor ha scritto:
>>
>> Hi everyone,
>> this wants to be a continuation of the discussion started here.
>>
>> I think that the last Hartley post is a good starting point,
>>
>> we could use protocolbuffers or grpc to implement the interface.
>> I will list the stats that in my opinion would be important to show in the
>> form of a proto-like code, just to give an idea
>>
>> message BgStats {
>> string status; // A string or byte that gives the current status of the
>> machine, if it's paused, running, stopped, error(which error?) repeated
>> float pos = 3; // array containing the position in real world coordinates
>> for each axis
>> float temp; // the temperature thing
>> float spindle_speed;
>> repeated float pos; // Real world axes coordinates
>> repeated float speed; // speed? Or we could derive it outside beagleg
>> }
>>
>> and, a command request
>>
>> message BgCommand {
>> string command; // start, stop, pause
>> }
>>
>>
>> -lr
>
> --
> You received this message because you are subscribed to the Google Groups
> "beagleg-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
beagleg-dev...@googlegroups.com.
> To post to this group, send email to
beagl...@googlegroups.com.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/beagleg-dev/bb66f205-269f-4225-956f-9cce847898bb%40googlegroups.com.
>
> For more options, visit
https://groups.google.com/d/optout.