Skip to content

Commit

Permalink
Use sys.argv for rclcpp::init when no args are passed
Browse files Browse the repository at this point in the history
  • Loading branch information
JafarAbdi committed Nov 13, 2024
1 parent c0a3c69 commit 391e41a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion python/src/rviz_visual_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ PYBIND11_MODULE(pyrviz_visual_tools, m)
*/
m.def(
"init",
[](const std::vector<std::string>& args) {
[](std::vector<std::string> args) {
if (args.empty())
{
args = py::module::import("sys").attr("argv").cast<std::vector<std::string>>();
}
std::vector<const char*> raw_args;
raw_args.reserve(args.size());
for (const auto& arg : args)
Expand Down

0 comments on commit 391e41a

Please sign in to comment.