We connected two hands to a single USB to RS485 adapter with the hope to control both hands by read/writing to one, then the other sequentially.
We tried something like the following using the C++ API, but it did not work.
AHWrapper wrapperLeft = AHWrapper(0x50, 460800);
wrapperLeft.connect();
AHWrapper wrapperRight = AHWrapper(0x51, 460800);
wrapperRight.connect();
while (running) {
wrapperLeft.read_write_once(/* params */);
wrapperLeft.read_write_once(/* params */);
}
We looked into the code and found that connect() should only be called once, regardless of how many AHWrappers are instantiated. E.g.:
AHWrapper wrapperLeft = AHWrapper(0x50, 460800);
AHWrapper wrapperRight = AHWrapper(0x51, 460800);
wrapperRight.connect();
while (running) {
wrapperLeft.read_write_once(/* params */);
wrapperLeft.read_write_once(/* params */);
}
While this works, the API is not intuitive for controlling multiple hands, and we're not sure of the behavior when the AHWrapper destructor is called multiple times. It seems fairly simple to fix by making the connect function static and adding a disconnect function.
We connected two hands to a single USB to RS485 adapter with the hope to control both hands by read/writing to one, then the other sequentially.
We tried something like the following using the C++ API, but it did not work.
We looked into the code and found that
connect()should only be called once, regardless of how manyAHWrappers are instantiated. E.g.:While this works, the API is not intuitive for controlling multiple hands, and we're not sure of the behavior when the
AHWrapperdestructor is called multiple times. It seems fairly simple to fix by making theconnectfunction static and adding adisconnectfunction.