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

Automatic polling for exogenous signals #570

Merged
merged 9 commits into from
Jan 12, 2023

Conversation

GiulioRomualdi
Copy link
Member

@GiulioRomualdi GiulioRomualdi commented Oct 5, 2022

Thanks to this PR the YarpRobotLoggerDevice will automatically connect to the exogenous ports. So no need to run it before the walking-controller

Moreover:

  • The remote control board will use udp as a carrier
  • the readouts from the genericSensorClient (wrenches) are retrieved using udp
  • the multipleanalogsensorsclient data are collected with fast_tcp
  • the logging of the robot cameras is disabled
  • The files are formatted

@GiulioRomualdi GiulioRomualdi force-pushed the device/polling_exogenous branch 5 times, most recently from b1ea423 to 79b8b2c Compare October 6, 2022 10:27
…pRobotLoggerDevice

- The remote control board will use udp as carrier
- the readouts from the genericSensorClient (wrenches) are retrieved using udp
- the multipleanalogsensorsclient data are colleced with fast_tcp
- the logging of the robot cameras are disabled
- The files are formatted
if (!allPortsConnected)
{
// check for new messages
yarp::profiler::NetworkProfiler::getPortsList(yarpPorts);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need the full list of ports if you already know the name of the port to connect to?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to check if the port exists to establish the connection. maybe we can directly do the connection if not connected. I don't know if we can improve the performances in this case

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In


you should be already querying the server for the existence of that port. So, I guessed that maybe asking the entire list of ports is not necessary. I think you can try to connect anyway, but I suspect in this case you will have errors printed in the terminal if the connection is not successful: https://github.com/robotology/yarp/blob/ea6ed180dd/src/libYARP_os/src/yarp/os/Network.cpp#L676

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok let me try to rephrase this part of the code 😃

if (!allPortsConnected)
{
// check for new messages
yarp::profiler::NetworkProfiler::getPortsList(yarpPorts);
for (const auto& port : yarpPorts)
{
// check if the port has not be already connected if exits, its resposive
auto vectorsCollectionSignal = m_vectorsCollectionSignals.find(port.name);
if (vectorsCollectionSignal != m_vectorsCollectionSignals.end())
{
if (!vectorsCollectionSignal->second.connected
&& yarp::os::Network::exists(port.name))
{
std::lock_guard<std::mutex> lock(vectorsCollectionSignal->second.mutex);
vectorsCollectionSignal->second.connected
= vectorsCollectionSignal->second.connect();
}
} else
{
// check if the port has not be already connected if exits, its resposive
auto vectorSignal = m_vectorSignals.find(port.name);
if (vectorSignal != m_vectorSignals.end())
{
if (!vectorSignal->second.connected && yarp::os::Network::exists(port.name))
{
std::lock_guard<std::mutex> lock(vectorSignal->second.mutex);
vectorSignal->second.connected = vectorSignal->second.connect();
}
}
}
}
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0534224 should implement what you suggested

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's pretty neat!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants