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 Jun 2, 2023
1 parent 071be6c commit 648da88
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 648da88

Please sign in to comment.