Open metropt opened 8 years ago
The basic idea of the driver is that the ROS thread is able to transmit serial commands to the motor driver, while a secondary thread receives data from the device. You can see these two threads getting setup in the main:
All that the Controller::spinOnce
function does is call the blocking read
method continuously. Unfortunately, it's not totally clear what the ack notifier does, as the other half of it was never written. But the idea was that this logic could safely pass responses from the reading thread back to the ROS thread, to enable the more transactional approach needed for sending configuration parameters down to the device, for example. Basically the ROS thread would send a message, then would block until the last_response_available_
, then process whatever was in last_response_
. This would occur via the sendAck
or sendAckVerify
stream entites.
Ultimately this wasn't implemented because for Grizzly we just bake all the configuration into the MBS script that is downloaded on startup. The script itself is checksummed, which obviates the need for a lot of messaging back and forth. However, if there was an ambition to have the configuration settable using rosparams, this could be a route to implementing it.
So, it takes care of data to be written into the serial port and other ros callbacks
ros::AsyncSpinner spinner(1);
spinner.start();
while this take care of incoming bytes?
while (ros::ok()) {
controller.spinOnce();
}
Do you have any example on how it could be done?
Basically the ROS thread would send a message, then would block until the last_responseavailable, then process whatever was in lastresponse. This would occur via the sendAck or sendAckVerify stream entites. take care of incoming bytes?
Hello,
Can you help me understand what these 3 lines does?