Skip to content

Commit 648da88

Browse files
committed
Use sys.argv for rclcpp::init when no args are passed
1 parent 071be6c commit 648da88

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

python/src/rviz_visual_tools.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ PYBIND11_MODULE(pyrviz_visual_tools, m)
2222
*/
2323
m.def(
2424
"init",
25-
[](const std::vector<std::string>& args) {
25+
[](std::vector<std::string> args) {
26+
if (args.empty())
27+
{
28+
args = py::module::import("sys").attr("argv").cast<std::vector<std::string>>();
29+
}
2630
std::vector<const char*> raw_args;
2731
raw_args.reserve(args.size());
2832
for (const auto& arg : args)

0 commit comments

Comments
 (0)