-
Notifications
You must be signed in to change notification settings - Fork 30
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
Created aikido_perception package #24
Conversation
reference_link(_reference_link) | ||
{ | ||
//Load JSON file | ||
tag_data = YAML::LoadFile(marker_data_path.c_str()); |
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 should accept a ResourceRetriever
and seamlessly fetch the configuration file by URI. This lets us seamlessly switch between retrieving files from a filesystem path (via LocalResourceRetriever
), a Catkin package (via CatkinResourceRetriever
), and other storage locations that we may potentially use in the future (e.g. an HTTP server, a database, etc).
The easiest way to do this is to read the entire file into an std::string
and pass that string to yaml-cpp.
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.
Is there an example of this, even if in a different context, somewhere? I've having trouble envisioning what the exact code would be.
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 is an example of doing this in DART's TinyXML helper code. The snippet looks something like this:
const dart::common::ResourcePtr resource = retriever->retrieve(uri);
if (!resource)
throw std::runtime_error("Failed opening URI.");
// C++11 guarantees that std::string has contiguous storage.
const std::size_t size = resource->getSize();
std::string content;
content.resize(size);
if (resource->read(&content.front(), size, 1) != 1)
throw std::runtime_error("Failed reading from URI.");
This is a good start. I left some specific commits on the diff, but I'd also like to open up discussion on a few high-level API discussions:
|
public: | ||
AprilTagsModule(ros::NodeHandle _node, const std::string _marker_topic, const std::string _marker_data_path, | ||
const dart::common::ResourceRetrieverPtr& _delegate, const std::string _urdf_path, | ||
const std::string _destination_frame, dart::dynamics::BodyNode* _reference_link); |
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.
Minor issues:
- DART uses
_camelCase
, not_snake_case
for parameter names. - Add a Doxygen comment block, including a one-line description of each argument.
- Take
ros::NodeHandle
byconst
reference to avoid an extra copy. - Take
std::string
parameters byconst
reference to avoid an extra copy. - Take a
Frame *
instead of aBodyNode *
for_reference_link
unless there is a strong reason to do otherwise. - Take
_marker_data_path
and_urdf_path
asdart::common::Uri
s if they will be passed into aResourceRetriever
; note thatstring
implicitly converts toUri
so this introduces no syntax overhead. - Naming the
ResourceRetriever
argument_delegate
only make sense forResourceRetriever
adaptors. Naming this_resourceRetriever
, or something similar, would be better.
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.
DART uses _camelCase, not _snake_case for parameter names.
To clarify, the recent convention of parameter names (Grey, Karen, and I agreed) in DART is camelCase
(without leading underscore). Sorry for the confusing. 😞
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.
the recent convention of parameter names [...] in DART is camelCase (without leading underscore).
🎊 That's great news! I was never a fan of the leading underscore. 😄
What is the convention for member variable names? Should we still use the m
prefix?
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.
Yes, we still use m
prefix for member variable names of class
(e.g., mCamelCase
), but it's unclear for struct
.
We're getting there! 😓 A few very minor high-level comments:
Reviewed 2 of 8 files at r2, 1 of 1 files at r11, 8 of 9 files at r12. aikido_perception/include/aikido/perception/AprilTagsModule.hpp, line 21 [r13] (raw file):
aikido_perception/include/aikido/perception/AprilTagsModule.hpp, line 36 [r13] (raw file): aikido_perception/include/aikido/perception/ConfigDataLoader.hpp, line 11 [r13] (raw file): aikido_perception/include/aikido/perception/ConfigDataLoader.hpp, line 17 [r13] (raw file):
A good litmus test for this is to look for verbs (e.g. "gets", "sets", "computes") and be wary of docstrings that have none. aikido_perception/include/aikido/perception/ConfigDataLoader.hpp, line 22 [r13] (raw file):
aikido_perception/include/aikido/perception/PerceptionModule.hpp, line 17 [r13] (raw file): aikido_perception/include/aikido/perception/PerceptionModule.hpp, line 18 [r13] (raw file): aikido_perception/include/aikido/perception/PerceptionModule.hpp, line 19 [r13] (raw file): aikido_perception/include/aikido/perception/PerceptionModule.hpp, line 21 [r13] (raw file): aikido_perception/include/aikido/perception/shape_conversions.hpp, line 23 [r10] (raw file): aikido_perception/include/aikido/perception/YamlFileLoader.hpp, line 16 [r13] (raw file):
aikido_perception/src/AprilTagsModule.cpp, line 49 [r9] (raw file): aikido_perception/src/AprilTagsModule.cpp, line 31 [r13] (raw file):
aikido_perception/src/shape_conversions.cpp, line 7 [r10] (raw file): Comments from Reviewable |
…lrobotics/aikido into feature/perceptionmodule
Reviewed 2 of 8 files at r2, 12 of 12 files at r14. aikido_perception/include/aikido/perception/AprilTagsDatabase.hpp, line 12 [r14] (raw file): aikido_perception/include/aikido/perception/PerceptionModule.hpp, line 16 [r14] (raw file):
aikido_perception/include/aikido/perception/PerceptionModule.hpp, line 21 [r14] (raw file): aikido_perception/include/aikido/perception/YamlAprilTagsDatabase.hpp, line 16 [r14] (raw file): aikido_perception/include/aikido/perception/YamlAprilTagsDatabase.hpp, line 22 [r14] (raw file):
aikido_perception/src/AprilTagsModule.cpp, line 30 [r14] (raw file): aikido_perception/src/AprilTagsModule.cpp, line 47 [r14] (raw file): If we do decide to keep this, note that we're missing a newline after the warning. aikido_perception/src/AprilTagsModule.cpp, line 84 [r14] (raw file): aikido_perception/src/YamlAprilTagsDatabase.cpp, line 59 [r14] (raw file): Comments from Reviewable |
Review status: 8 of 14 files reviewed at latest revision, 12 unresolved discussions. aikido_perception/include/aikido/perception/PerceptionModule.hpp, line 16 [r14] (raw file): aikido_perception/include/aikido/perception/YamlAprilTagsDatabase.hpp, line 16 [r14] (raw file): aikido_perception/src/AprilTagsModule.cpp, line 30 [r14] (raw file): aikido_perception/src/AprilTagsModule.cpp, line 47 [r14] (raw file): aikido_perception/src/YamlAprilTagsDatabase.cpp, line 58 [r9] (raw file): aikido_perception/src/YamlAprilTagsDatabase.cpp, line 59 [r14] (raw file): Comments from Reviewable |
Reviewed 2 of 8 files at r2, 3 of 12 files at r14, 6 of 6 files at r15. aikido_perception/include/aikido/perception/YamlAprilTagsDatabase.hpp, line 16 [r14] (raw file): aikido_perception/src/AprilTagsModule.cpp, line 49 [r9] (raw file): Comments from Reviewable |
Reviewed 2 of 8 files at r2, 2 of 12 files at r14, 5 of 5 files at r17. Comments from Reviewable |
Review status: 13 of 14 files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
Reviewed 1 of 12 files at r14, 1 of 1 files at r18. Comments from Reviewable |
Great work @Shushman. Thanks for putting up with all of the comments! |
Haha no worries @mkoval. It was an important learning experience for me too. And I'm sure there are many more to come 👍 |
This is the first attempt at a perception module for AIKIDO.
aikido_perception
as a packagePerceptionModule.hpp
AprilTagsModule.hpp/cpp
This change is