lugu / qiloop Goto Github PK
View Code? Open in Web Editor NEWAn implementation of QiMessaging in Go
License: MIT License
An implementation of QiMessaging in Go
License: MIT License
Error messages are hard to reason about since they are hand generated like:
return fmt.Errorf("call say failed: %s", err)
Go 1.13 provides an helper errors.Wrap which can be used like this:
return errors.Wrap(err, "say failed")
Please favor errors.Wrap and %w when it makes sense so we would use values for errors like disconnection, authentication failed, remote error...
Hello,
I was wondering if this library supports v5 nao based on naoqi 2.1.4?
I am running this command and get the following error
➜ ~ qiloop --qi-url tcp://192.168.2.9:9559 info --service ALVideoDevice
message dropped: no handler match: [Type: capability, ID: 2550, Service: 0, Object: 0, Action: 0, Size: 79]
connect: contact server: contact service: service connection error (ServiceDirectory): service
connection error (ServiceDirectory): authentication error: authentication failed: call authenticate
failed: can't find service, address: {0.0.8, id:3}
the contents of $HOME/.qiloop-auth.conf exist as expected.
Would you know why this happens?
When registering to a signal, events can be sent before the response.
Instead, after the call message, reply should be sent and then the event messages.
Here is the sequence observed with tcpdump (full capture is attached):
Frame 16: 110 bytes on wire (880 bits), 110 bytes captured (880 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1
Transmission Control Protocol, Src Port: 60332, Dst Port: 9559, Seq: 145, Ack: 2465, Len: 44
Data (44 bytes)
qi::Messaging
Source: 127.0.0.1:60332
Destination: 127.0.0.1:9559
Magic: 0x42dead42
Id: 284
Size: 16
Version: 0
Type: 1
Type: Call
Flags: 0
Service: 1
Service description: ServiceDirectory
Object: 1
Action: 0
Action description: RegisterEvent
Data: 0100000056000000414299a819a14c04
Then
Frame 17: 159 bytes on wire (1272 bits), 159 bytes captured (1272 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1
Transmission Control Protocol, Src Port: 9559, Dst Port: 60332, Seq: 2465, Ack: 189, Len: 93
Data (93 bytes)
qi::Messaging
Source: 127.0.0.1:9559
Destination: 127.0.0.1:60332
Magic: 0x42dead42
Id: 284
Size: 65
Version: 0
Type: 5
Type: Event
Flags: 0
Service: 1
Service description: ServiceDirectory
Object: 1
Action: 86
Data: 010000000200000000000000010000004c414299a819a14c0413000000000000009ec809…
Then:
Frame 19: 102 bytes on wire (816 bits), 102 bytes captured (816 bits)
Ethernet II, Src: 00:00:00_00:00:00 (00:00:00:00:00:00), Dst: 00:00:00_00:00:00 (00:00:00:00:00:00)
Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1
Transmission Control Protocol, Src Port: 9559, Dst Port: 60332, Seq: 2558, Ack: 189, Len: 36
Data (36 bytes)
qi::Messaging
Source: 127.0.0.1:9559
Destination: 127.0.0.1:60332
Magic: 0x42dead42
Id: 284
Size: 8
Version: 0
Type: 2
Type: Reply
Flags: 0
Service: 1
Service description: ServiceDirectory
Object: 1
Action: 0
Action description: RegisterEvent
Data: 414299a819a14c04
I am trying to implement this example of a memory service subscription and a callback function
like referenced in this python example.
import qi
app = qi.Application()
session = qi.Session()
session.connect("tcp://nao.local:9559")
memory = session.service("ALMemory")
tts = session.service("ALTextToSpeech")
def on_touched(event):
# value is 1 when pressed, 0 when released
if event > 0:
tts.say("ouch")
subscriber = memory.subscriber("FrontTactilTouched")
subscriber.signal.connect(on_touched)
app.run()
I am trying to understand how to subscribe to that memory service signal through examples/signals/main.go where you subscribe to a serviceAdded callback channel that seems similar to the related functions inside the ALMemoryInterface
interface ALMemory
fn subscriber(eventName: str) -> obj
fn subscribeToEvent(name: str,callbackModule: str,callbackMethod: str)
fn unsubscribeToEvent(name: str,callbackModule: str)
end
What I don't understand is that the services.idl file does not contain the subscribe methods for the serviceAdded example - so how is that subscribeServiceAdded method being generated inside bus/services/gen_proxy.go - so that I could run something similar to this:
// Obtain a proxy to the service
alm, err = proxies.ALMemory(nil)
if err != nil {
panic(err)
}
var unsubscribe func()
var sig chan int
// subscribe to the signal "FrontTactilTouched" of AlMemory service.
unsubscribe, sig, err = alm.Subscribe("FrontTactilTouched")
Thanks for your help!
I found this interesting library ->
https://github.com/Niraj-Fonseka/recognize
It deploys a python opencv2 grpc server called from a go client.
Should we add this example to qiloop?
What would be the best approach here as nao v5 already has opencv2 pre-installed as well as nao v6 coming with opencv3 from what I have read.
Alternatively, it would be possible to run opencv off Nao and just stream ALVideoDevice into an external opencv lib -> such is described here with a webcam capture example.
https://medium.com/@fonseka.live/detect-faces-using-golang-and-opencv-fbe7a48db055
https://gocv.io/
Would be interested in your opinion what might be the best way to marry qiloop and opencv or gocv capabilities.
Thanks for your time.
when running the motion example, it fails with the error:
panic: call moveTo failed: ISerialization error Status Read Past End
This is likely due to a wrong resolution of the action ID since the ALMotion service have several "moveTo" methods taking various arguments. If this is confirmed, action resolution needs to be improved by checking the signature as well as the method name.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.