-
Notifications
You must be signed in to change notification settings - Fork 38
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
Added Vector Collection Server for publishing information for real-time users in the YARPRobotLoggerDevice #796
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done!
.def("getMetadata", | ||
[](VectorsCollectionClient& impl) -> std::map<std::string, std::vector<std::string>> | ||
{ | ||
BipedalLocomotion::YarpUtilities::VectorsCollectionMetadata metadata; | ||
impl.getMetadata(metadata); | ||
return metadata.vectors; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two things:
- in Python we tend to use snake case for methods and variables for example
get_metadata
- Can you directly return a metadata and not the vector? In this case you need to write the bindings for metadata
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -0,0 +1,57 @@ | |||
#ifndef BIPEDAL_LOCOMOTION_fRAMEWORK_YARP_ROBOT_LOGGER_DEVICE_VTN_H |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a big fan of these kinds of define. Can you add these names directly in the main class as attributes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 568addd
} | ||
|
||
void YarpRobotLoggerDevice::storeAndSendLoggingData(const std::string& name, | ||
const Eigen::VectorXd& data, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use eigen ref here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually a problem. we should understand why
…m/bipedal-locomotion-framework into vectorCollectionServerRT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @nicktrem, sorry for the delayed response. I've been occupied with various lab activities and personal deadlines, which delayed the review process. Upon revisiting the PR, there are some points that need to be addressed before merging it. Once this is resolved, I'll move on to ami-iit/robot-log-visualizer#77
[](const VectorsCollectionMetadata& impl, yarp::os::ConnectionWriter& connection) -> bool { | ||
return impl.write(connection); | ||
}) | ||
.def("toString", &VectorsCollectionMetadata::toString) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.def("toString", &VectorsCollectionMetadata::toString) | |
.def("to_string", &VectorsCollectionMetadata::toString) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 107860c
.def("readWireReader", | ||
[](VectorsCollectionMetadata& impl, yarp::os::idl::WireReader& reader) -> bool { | ||
return impl.read(reader); | ||
}) | ||
.def("readConnectionReader", | ||
[](VectorsCollectionMetadata& impl, yarp::os::ConnectionReader& connection) -> bool { | ||
return impl.read(connection); | ||
}) | ||
.def("writeWireWriter", | ||
[](const VectorsCollectionMetadata& impl, const yarp::os::idl::WireWriter& writer) -> bool { | ||
return impl.write(writer); | ||
}) | ||
.def("writeConnectionWriter", | ||
[](const VectorsCollectionMetadata& impl, yarp::os::ConnectionWriter& connection) -> bool { | ||
return impl.write(connection); | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not clear to me, in theory, there are no bindings of yarp::os::ConnectionWriter
and yarp::os::idl::WireReader
so you cannot call this method from python. How did you test them? moreover you can check this for function overloading in pybind11 https://pybind11.readthedocs.io/en/stable/classes.html#overloaded-methods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to discuss face-to-face
// if (m_pimpl->isMetadataFinalized) | ||
// { | ||
// log()->error("[VectorsCollectionServer::populateMetadata] The metadata has been already " | ||
// "populated."); | ||
// return false; | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be re-added before merging this PR 🤔. Why was it removed in the first place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be better to discuss face-to-face. This has to do with the issue regarding adding new data to the vectors Collection on the fly
|
||
// check if the key has been already used | ||
// // check if the key has been already used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// // check if the key has been already used | |
// check if the key has been already used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in cf0370b
// if (!m_pimpl->isMetadataFinalized) | ||
// { | ||
// log()->error("{} The metadata has not been finalized.", logPrefix); | ||
// return false; | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to discuss face-to-face
} | ||
else if (externalSignalCollection == nullptr && signal.connected) | ||
{ | ||
signal.numMissedPackets++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This statement is inaccurate. The logger does not consider the period of the exogenous signal. In fact, the signal may arrive at a frequency different from that of the logger, which is acceptable. I will completely remove this logic as it would introduce misleading information. For example, if the exogenous signal arrives from a controller running at 100 Hz while the logger operates at 1 kHz, there are no missing packets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to discuss face-to-face. I understand the issue here. This logic was initially put in to disconnect exogenous signals which were no longer running and to reset the signal.connected flag. If an exogenous signal is not disconnected when a YARP device is restarted, it was noticed that it will not be able to receive new data from that device
if(sendDataRT) | ||
m_vectorCollectionRTDataServer.sendData(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(sendDataRT) | |
m_vectorCollectionRTDataServer.sendData(); | |
if(sendDataRT) | |
{ | |
m_vectorCollectionRTDataServer.sendData(); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in cf0370b
@@ -62,6 +65,9 @@ class YarpRobotLoggerDevice : public yarp::dev::DeviceDriver, | |||
std::unique_ptr<BipedalLocomotion::RobotInterface::YarpSensorBridge> m_robotSensorBridge; | |||
std::unique_ptr<BipedalLocomotion::RobotInterface::YarpCameraBridge> m_cameraBridge; | |||
|
|||
bool sendDataRT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool sendDataRT; | |
bool m_sendDataRT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 70e0b6f
@@ -93,16 +99,17 @@ class YarpRobotLoggerDevice : public yarp::dev::DeviceDriver, | |||
BipedalLocomotion::YarpUtilities::VectorsCollectionClient client; | |||
BipedalLocomotion::YarpUtilities::VectorsCollectionMetadata metadata; | |||
std::string signalName; | |||
unsigned int numMissedPackets; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As explained below I would remove this information
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to discuss face-to-face
Eigen::Matrix<double, 1, 1> newMetadataVector; | ||
if(newMetadata) | ||
m_updatedMetadataSignalVal = (m_updatedMetadataSignalVal + 1) % 2; | ||
newMetadataVector << m_updatedMetadataSignalVal; | ||
|
||
m_vectorCollectionRTDataServer.populateData(ROBOT_RT_ROOT_NAME + TREE_DELIM + "newMetadata", newMetadataVector); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear to me the what is the purpose of this code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to discuss face-to-face. This code informs the robot-log-visualizer when new metadata has been added to the vectors collection thus allowing the visualizer to append the data to the variable tree so the user can visualize it. It is a flag
After face-to-face discussions with @S-Dafarra, @GiulioRomualdi, and @gabrielenava. This PR will be broken up into smaller PRs so it is easier to manage See the list of smaller PRs below: |
Edited the functionality of the real-time logger to use a vector collection client/server