diff --git a/clover/launch/led.launch b/clover/launch/led.launch index 3e9238979..c2923ce95 100644 --- a/clover/launch/led.launch +++ b/clover/launch/led.launch @@ -21,7 +21,8 @@ - + + diff --git a/clover/src/led.cpp b/clover/src/led.cpp index 91438df3d..b9927900f 100644 --- a/clover/src/led.cpp +++ b/clover/src/led.cpp @@ -309,15 +309,19 @@ int main(int argc, char **argv) nh_priv.param("notify/low_battery/threshold", low_battery_threshold, 3.7); nh_priv.param("notify/error/ignore", error_ignore, {}); - ros::service::waitForService("set_leds"); // cannot work without set_leds service - set_leds_srv = nh.serviceClient("set_leds", true); + std::string led; // led namespace + nh_priv.param("led", led, std::string("led")); + if (!led.empty()) led += "/"; + + ros::service::waitForService(led + "set_leds"); // cannot work without set_leds service + set_leds_srv = nh.serviceClient(led + "set_leds", true); // wait for leds count info - handleState(*ros::topic::waitForMessage("state", nh)); + handleState(*ros::topic::waitForMessage(led + "state", nh)); - auto state_sub = nh.subscribe("state", 1, &handleState); + auto state_sub = nh.subscribe(led + "state", 1, &handleState); - auto set_effect = nh.advertiseService("set_effect", &setEffect); + auto set_effect = nh.advertiseService(led + "set_effect", &setEffect); auto mavros_state_sub = nh.subscribe("mavros/state", 1, &handleMavrosState); auto battery_sub = nh.subscribe("mavros/battery", 1, &handleBattery);