You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 27, 2021. It is now read-only.
After sending this Command-1 as a message, I send some Command-2 (with a format similar to the above code) to do something else with the robot. But, since the length of the two messages is different (for example the second message is shorter), there will be some unknown characters at the end of the second message when I send it and the robot does not recognize it.
I tried to solve this by adding a lot of spaces at the end of the second message line (because my messages are somehow considered as JSON), but it becomes intractable when the number of commands goes to around 10 (I also tried to make it smarter by comparing the length of each message with the maximum length of the messages being sent before that, and add extra spaces at the end of the message if it's shorter than the max, but still doesn't work all the time!).
So, I thought a better idea could be available for this issue. It seems that there is a buffer-like variable that the messages are being overwritten on that. If so, that could be resolved if I have access to that variable to clear it every time before sending a new message.
Please let me know if you think different, or you have any idea to resolve this issue.
Thanks
The text was updated successfully, but these errors were encountered:
@Ahmadreza-Shahrokhshahi I don't think this project or nanomsg itself are actively maintained. I'm also not involved, but I just wanted to respond in case nobody else does.
I'm not familiar with `ffi.new`, but I wouldn't be surprised if there were
a lot of complicated library interop issues with that technique, doubly so
on python2. If you're on python3, I'd probably just send it `"my
data".encode()` as the `data` argument and see if that helps.
I'm not familiar with ffi.new, but I wouldn't be surprised if there were a lot of complicated library interop issues with that technique, doubly so on python2. If you're on python3, I'd probably just send it "my data".encode() as the data argument and see if that helps.
I'm using python3. The other problem is that the file socket.py that I mentioned is located at the following address: ${SRC}/venv/lib/python3.6/site-packages/nnpy assuming $SRC is the source of my code, but it seems it is not the file being used in the code when calling nnpy.Socket.send (because I have commented the send function and it worked). Do you have any idea what else could be the location of this socket.py file that is running by the code?
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi @djc @mayfield @bnewbold
I am using
nnpy
to connect to my robot. It is at the following format:push = nnpy.Socket(nnpy.AF_SP, nnpy.PUSH)
push.connect(rep_address)
str1 = '{"category":["Main","Tasks"],"name":"Command-1","data":{}}'
push.send(str1)
time.sleep(1)
push.close()
After sending this Command-1 as a message, I send some Command-2 (with a format similar to the above code) to do something else with the robot. But, since the length of the two messages is different (for example the second message is shorter), there will be some unknown characters at the end of the second message when I send it and the robot does not recognize it.
I tried to solve this by adding a lot of spaces at the end of the second message line (because my messages are somehow considered as JSON), but it becomes intractable when the number of commands goes to around 10 (I also tried to make it smarter by comparing the length of each message with the maximum length of the messages being sent before that, and add extra spaces at the end of the message if it's shorter than the max, but still doesn't work all the time!).
So, I thought a better idea could be available for this issue. It seems that there is a buffer-like variable that the messages are being overwritten on that. If so, that could be resolved if I have access to that variable to clear it every time before sending a new message.
Please let me know if you think different, or you have any idea to resolve this issue.
Thanks
The text was updated successfully, but these errors were encountered: