Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help getting this going #1

Open
kaspesla opened this issue Oct 14, 2022 · 12 comments
Open

Help getting this going #1

kaspesla opened this issue Oct 14, 2022 · 12 comments
Labels
bug Something isn't working

Comments

@kaspesla
Copy link

kaspesla commented Oct 14, 2022

Hello Theo,
This module looks awesome and we're excited to try this out here at Code & Circuit. I've got it installed but we're running into a grpc error running hello_spot.js.
Do you have any ideas what this means?
Thanks!
-Ken

Pensez à retirer le log du catch
Error: 13 INTERNAL: Received RST_STREAM with code 2 triggered by internal client error: Protocol error
at Object.callErrorFromStatus (/Users/ken/Downloads/spot-sdk-js-main 2/node_modules/@grpc/grpc-js/build/src/call.js:31:19)
at Object.onReceiveStatus (/Users/ken/Downloads/spot-sdk-js-main 2/node_modules/@grpc/grpc-js/build/src/client.js:195:52)
at Object.onReceiveStatus (/Users/ken/Downloads/spot-sdk-js-main 2/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:365:141)
at Object.onReceiveStatus (/Users/ken/Downloads/spot-sdk-js-main 2/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:328:181)
at /Users/ken/Downloads/spot-sdk-js-main 2/node_modules/@grpc/grpc-js/build/src/call-stream.js:188:78
at processTicksAndRejections (node:internal/process/task_queues:78:11)
for call at
at ServiceClientImpl.makeUnaryRequest (/Users/ken/Downloads/spot-sdk-js-main 2/node_modules/@grpc/grpc-js/build/src/client.js:163:34)
at ServiceClientImpl.getAuthToken (/Users/ken/Downloads/spot-sdk-js-main 2/node_modules/@grpc/grpc-js/build/src/make-client.js:105:19)
at /Users/ken/Downloads/spot-sdk-js-main 2/bosdyn-client/common.js:281:9
at new Promise (<anonymous>)
at AuthClient.#make (/Users/ken/Downloads/spot-sdk-js-main 2/bosdyn-client/common.js:278:12)
at AuthClient.call (/Users/ken/Downloads/spot-sdk-js-main 2/bosdyn-client/common.js:332:34)
at AuthClient.auth (/Users/ken/Downloads/spot-sdk-js-main 2/bosdyn-client/auth.js:128:17)
at Robot.authenticate (/Users/ken/Downloads/spot-sdk-js-main 2/bosdyn-client/robot.js:302:42)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async hello_spot (/Users/ken/Downloads/spot-sdk-js-main 2/examples/hello_spot/hello_spot.js:25:3) {
  code: 13,
details: 'Received RST_STREAM with code 2 triggered by internal client error: Protocol error',
metadata: Metadata { internalRepr: Map(0) {}, options: {} 
}
}
@TheoPierne
Copy link
Owner

Hello 👋,
I'm glad that you have an interest in this module!

Do you have any ideas what this means?

After some research I found out this error can throw when an internal error occurred with the server (spot), in our case I think it's just an error in the code :

const auth_channel = this.ensure_insecure_channel(this._bootstrap_service_authorities[default_service_name]);

For testing purpose I used ensure_insecure_channel but we would use ensure_secure_channel instead.
ensure_insecure_channel don't create the required credentials to communicate with the robot, so basically maybe the connection cannot be correctly established between the client and the robot.

I will patch it soon, if you have any other problem let me know!

P.S.: Sorry if my English isn't good.

@TheoPierne
Copy link
Owner

It's now fixed (I hope), tell me if this fix the problem!

@kaspesla
Copy link
Author

kaspesla commented Oct 16, 2022 via email

@kaspesla
Copy link
Author

Unfortunately, it's still getting the same error.
At least I think it is the same. Here is the whole output.
Let me know if I can help troubleshoot.
Best Regards,
Ken

ken@lll spot-sdk-js % node examples/hello_spot/hello_spot.js --username spot --password my password -v 192.168.80.3
[2022-10-17 10:46:38] [debug] [SDK]: [SDK] Creating standard Sdk, cert glob: "undefined" 
Pensez à modifier authenticate dans le fichier robot.js
[2022-10-17 10:46:38] [debug] [HelloSpotClient]: [ROBOT] Created channel to 192.168.80.3 at port 443 with authority auth.spot.robot 
[2022-10-17 10:46:38] [debug] [HelloSpotClient]: [ROBOT] Created client for auth 
Pensez à modif common.js pour retirer insecure credentials
[2022-10-17 10:46:38] [debug] [HelloSpotClient]: [COMMON] blocking request: /bosdyn.api.AuthService/GetAuthToken 
{"header":{"requestTimestamp":{"seconds":1666017998,"nanos":686000128},"clientName":"HelloSpotClientlll.local:sdk.js-46882","disableRpcLogging":false},"username":"spot","password":"mypassword","token":"","applicationToken":""}
 
Pensez à retirer le log du catch
Error: 13 INTERNAL: Received RST_STREAM with code 2 triggered by internal client error: Protocol error
    at Object.callErrorFromStatus (/Users/ken/Sandbox/spot-sdk-js/node_modules/@grpc/grpc-js/build/src/call.js:31:19)
    at Object.onReceiveStatus (/Users/ken/Sandbox/spot-sdk-js/node_modules/@grpc/grpc-js/build/src/client.js:195:52)
    at Object.onReceiveStatus (/Users/ken/Sandbox/spot-sdk-js/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:365:141)
    at Object.onReceiveStatus (/Users/ken/Sandbox/spot-sdk-js/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:328:181)
    at /Users/ken/Sandbox/spot-sdk-js/node_modules/@grpc/grpc-js/build/src/call-stream.js:188:78
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
for call at
    at ServiceClientImpl.makeUnaryRequest (/Users/ken/Sandbox/spot-sdk-js/node_modules/@grpc/grpc-js/build/src/client.js:163:34)
    at ServiceClientImpl.getAuthToken (/Users/ken/Sandbox/spot-sdk-js/node_modules/@grpc/grpc-js/build/src/make-client.js:105:19)
    at /Users/ken/Sandbox/spot-sdk-js/bosdyn-client/common.js:281:9
    at new Promise (<anonymous>)
    at AuthClient.#make (/Users/ken/Sandbox/spot-sdk-js/bosdyn-client/common.js:278:12)
    at AuthClient.call (/Users/ken/Sandbox/spot-sdk-js/bosdyn-client/common.js:332:34)
    at AuthClient.auth (/Users/ken/Sandbox/spot-sdk-js/bosdyn-client/auth.js:128:17)
    at Robot.authenticate (/Users/ken/Sandbox/spot-sdk-js/bosdyn-client/robot.js:296:42)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async hello_spot (/Users/ken/Sandbox/spot-sdk-js/examples/hello_spot/hello_spot.js:25:3) {
  code: 13,
  details: 'Received RST_STREAM with code 2 triggered by internal client error: Protocol error',
  metadata: Metadata { internalRepr: Map(0) {}, options: {} }
}
Unclassified exception: Received RST_STREAM with code 2 triggered by internal client error: Protocol error
/Users/ken/Sandbox/spot-sdk-js/bosdyn-client/channel.js:196
  return new RpcError(msg);
         ^

RpcError: Received RST_STREAM with code 2 triggered by internal client error: Protocol error
    at translate_exception (/Users/ken/Sandbox/spot-sdk-js/bosdyn-client/channel.js:196:10)
    at AuthClient.call (/Users/ken/Sandbox/spot-sdk-js/bosdyn-client/common.js:341:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Robot.authenticate (/Users/ken/Sandbox/spot-sdk-js/bosdyn-client/robot.js:296:24)
    at async hello_spot (/Users/ken/Sandbox/spot-sdk-js/examples/hello_spot/hello_spot.js:25:3)
    at async main (/Users/ken/Sandbox/spot-sdk-js/examples/hello_spot/hello_spot.js:129:3)

@TheoPierne
Copy link
Owner

I made some research and I found out that can be a problem with the SSL encryption caused by a bad using of the SSL certificate in the code, I started working on a fix but I don't know when I'll be done.

I'll let you know when I finish it!

@TheoPierne
Copy link
Owner

Hello,

I just made some fixes, let me know if this changes anything. If you encounter bugs let me know and send me in this issue, the version of his software.

Have a good day!

@kaspesla
Copy link
Author

Good morning! I'm getting a different error now. Let me know if there's anything you want me to try on this end.

One of the students here is trying to do a similar thing but with C#. He has not got it completely working yet but he's gotten beyond the GPRC authentication steps so maybe he can look at your code and provide some suggestions as far as how to create the authentication channels and provide the certificates properly. I'l ask him on Wednesday.

[2022-10-21 10:12:54] [debug] [SDK]: [SDK] Creating standard Sdk, cert glob: "undefined" 
[2022-10-21 10:12:54] [debug] [HelloSpotClient]: [ROBOT] Created channel to 192.168.80.3 at port 443 with authority auth.spot.robot 
[2022-10-21 10:12:54] [debug] [HelloSpotClient]: [ROBOT] Created client for auth 
[2022-10-21 10:12:54] [debug] [HelloSpotClient]: [COMMON] blocking request: /bosdyn.api.AuthService/GetAuthToken 
{"header":{"requestTimestamp":{"seconds":1666361574,"nanos":696000000},"clientName":"HelloSpotClientlll.local:sdk.js-60476","disableRpcLogging":false},"username":"spot","password":"mypassword","token":"","applicationToken":""}
 
(node:60476) [DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permitted by RFC 6066. This will be ignored in a future version.
(Use `node --trace-deprecation ...` to show where the warning was created)
Pensez à retirer le log du catch
Error: 14 UNAVAILABLE: No connection established
    at Object.callErrorFromStatus (/Users/ken/Sandbox/spot-sdk-js/node_modules/@grpc/grpc-js/build/src/call.js:31:19)
    at Object.onReceiveStatus (/Users/ken/Sandbox/spot-sdk-js/node_modules/@grpc/grpc-js/build/src/client.js:195:52)
    at Object.onReceiveStatus (/Users/ken/Sandbox/spot-sdk-js/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:365:141)
    at Object.onReceiveStatus (/Users/ken/Sandbox/spot-sdk-js/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:328:181)
    at /Users/ken/Sandbox/spot-sdk-js/node_modules/@grpc/grpc-js/build/src/call-stream.js:188:78
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
for call at
    at ServiceClientImpl.makeUnaryRequest (/Users/ken/Sandbox/spot-sdk-js/node_modules/@grpc/grpc-js/build/src/client.js:163:34)
    at ServiceClientImpl.getAuthToken (/Users/ken/Sandbox/spot-sdk-js/node_modules/@grpc/grpc-js/build/src/make-client.js:105:19)
    at /Users/ken/Sandbox/spot-sdk-js/bosdyn-client/common.js:279:9
    at new Promise (<anonymous>)
    at AuthClient.#make (/Users/ken/Sandbox/spot-sdk-js/bosdyn-client/common.js:276:12)
    at AuthClient.call (/Users/ken/Sandbox/spot-sdk-js/bosdyn-client/common.js:330:34)
    at AuthClient.auth (/Users/ken/Sandbox/spot-sdk-js/bosdyn-client/auth.js:128:17)
    at Robot.authenticate (/Users/ken/Sandbox/spot-sdk-js/bosdyn-client/robot.js:296:42)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async hello_spot (/Users/ken/Sandbox/spot-sdk-js/examples/hello_spot/hello_spot.js:25:3) {
  code: 14,
  details: 'No connection established',
  metadata: Metadata { internalRepr: Map(0) {}, options: {} }
}
/Users/ken/Sandbox/spot-sdk-js/bosdyn-client/channel.js:202
    return new UnableToConnectToRobotError(msg);
           ^

UnableToConnectToRobotError: No connection established
    at translate_exception (/Users/ken/Sandbox/spot-sdk-js/bosdyn-client/channel.js:202:12)
    at AuthClient.call (/Users/ken/Sandbox/spot-sdk-js/bosdyn-client/common.js:339:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Robot.authenticate (/Users/ken/Sandbox/spot-sdk-js/bosdyn-client/robot.js:296:24)
    at async hello_spot (/Users/ken/Sandbox/spot-sdk-js/examples/hello_spot/hello_spot.js:25:3)
    at async main (/Users/ken/Sandbox/spot-sdk-js/examples/hello_spot/hello_spot.js:129:3)

@TheoPierne
Copy link
Owner

Hey !

I notice I didn't pass the good credentials and options to the stub constructor

set channel(channel) {
this._channel = channel;
this._stub = new this._stub_creation_func(
channel.target.path,
channel.credentials.channelCredentials,
);
}

I think it should work now 🤞

set channel(channel) {
this._channel = channel;
this._stub = new this._stub_creation_func(
channel.target.path,
channel.credentials,
channel.options,
);
}

In case my modification didn't fix it, add this to the environment variables, rerun hello_spot.js and copy paste the terminal in this issue, it will provide me more details logs from GRPC.

  • Linux:
export GRPC_HELLO_SECURE=Y
export GRPC_TRACE=subchannel
export GRPC_VERBOSITY=DEBUG
  • Windows:
set GRPC_HELLO_SECURE=Y
set GRPC_TRACE=subchannel
set GRPC_VERBOSITY=DEBUG

One of the students here is trying to do a similar thing but with C#. He has not got it completely working yet but he's gotten beyond the GPRC authentication steps so maybe he can look at your code and provide some suggestions as far as how to create the authentication channels and provide the certificates properly. I'l ask him on Wednesday.

No problem, I appreciate your help !

@kaspesla
Copy link
Author

Hey we have some progress.
It gets the channels connected! auth, e_stop and power.
The motor fans power on now and it sounds like it's starting up, but then after a few seconds it gets this error:

lots of output repeating the PowerCommandFeedback messages over and over again and then it throws. It must be getting null back from the power_command_feedback


-91
[2022-10-26 17:58:05] [debug] [HelloSpotClient]: [COMMON] blocking request: /bosdyn.api.PowerService/PowerCommandFeedback 
{"header":{"requestTimestamp":{"seconds":1666821485,"nanos":349999872},"clientName":"HelloSpotClientlll.local:sdk.js-78339","disableRpcLogging":false},"powerCommandId":6}
 
[2022-10-26 17:58:05] [debug] [HelloSpotClient]: [COMMON] response: /bosdyn.api.PowerService/PowerCommandFeedback 
{"header":{"requestHeader":{"requestTimestamp":{"seconds":1666821485,"nanos":349999872},"clientName":"HelloSpotClientlll.local:sdk.js-78339","disableRpcLogging":false},"requestReceivedTimestamp":{"seconds":1666821772,"nanos":962526274},"responseTimestamp":{"seconds":1666821773,"nanos":62624314},"error":{"code":1,"message":""},"request":{"typeUrl":"type.googleapis.com/bosdyn.api.PowerCommandFeedbackRequest","value":"CjUKDAjt2uaaBhCApvKmARIlSGVsbG9TcG90Q2xpZW50bGxsLmxvY2FsOnNkay5qcy03ODMzORAG"}},"status":11,"blockingFaultsList":[]}
 
CommandTimedOutError: TypeError: Cannot read properties of undefined (reading '0')
    at _power_command (/Users/ken/Sandbox/spot-sdk-js/bosdyn-client/power.js:439:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async power_on_motors (/Users/ken/Sandbox/spot-sdk-js/bosdyn-client/power.js:248:3)
    at async power_on (/Users/ken/Sandbox/spot-sdk-js/bosdyn-client/power.js:226:3)
    at async Robot.power_on (/Users/ken/Sandbox/spot-sdk-js/bosdyn-client/robot.js:456:5)
    at async hello_spot (/Users/ken/Sandbox/spot-sdk-js/examples/hello_spot/hello_spot.js:40:5)
    at async main (/Users/ken/Sandbox/spot-sdk-js/examples/hello_spot/hello_spot.js:129:3) {
  response: null
}
[2022-10-26 17:58:05] [debug] [HelloSpotClient]: [COMMON] blocking request: /bosdyn.api.LeaseService/ReturnLease 
{"header":{"requestTimestamp":{"seconds":1666821485,"nanos":470000128},"clientName":"HelloSpotClientlll.local:sdk.js-78339","disableRpcLogging":false},"lease":{"resource":"body","epoch":"WTScUxIROJsvXnlo","sequenceList":[10],"clientNamesList":["root"]}}
 
[2022-10-26 17:58:05] [debug] [HelloSpotClient]: [COMMON] response: /bosdyn.api.LeaseService/ReturnLease 
{"header":{"requestHeader":{"requestTimestamp":{"seconds":1666821485,"nanos":470000128},"clientName":"HelloSpotClientlll.local:sdk.js-78339","disableRpcLogging":false},"requestReceivedTimestamp":{"seconds":1666821773,"nanos":79762367},"responseTimestamp":{"seconds":1666821773,"nanos":79975119},"error":{"code":1,"message":""},"request":{"typeUrl":"type.googleapis.com/bosdyn.api.ReturnLeaseRequest","value":"CjUKDAjt2uaaBhCAxI7gARIlSGVsbG9TcG90Q2xpZW50bGxsLmxvY2FsOnNkay5qcy03ODMzORIhCgRib2R5EhBXVFNjVXhJUk9Kc3ZYbmxvGgEKIgRyb290"}},"status":1}
 
oui time sync
oui token

@TheoPierne
Copy link
Owner

Hey, I'm glad my previous fix is working!

I pushed a fix for the TypeError in power.js : bc1b896

If you find any other bug, let me know! (Maybe close this issue and create others one if needed)

@kaspesla
Copy link
Author

Will try it as soon as possible. Spot is out on a trip today :)

@TheoPierne
Copy link
Owner

Also don't forget to run an estop when running hello_spot.js
(https://github.com/TheoPierne/spot-sdk-js/tree/main/examples/hello_spot#common-problems)

Maybe use the official one, my version of the estop doesn't work well.

Spot is out on a trip today :)

Well have a good trip Spot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants