ROS service to turn power ON/OFF to robot arm?

Hi all.

To clarify, I am tasked with incorporating a robot arm onto a mobile robot platform (not the Magni) that was developed over the course of several years at my college. A few teams back, the major work was done to convert everything from running on an old framework to the ROS and RPi 3B+ framework that it has now.

The manipulator I picked is the Tinkerkit Braccio Robot Arm since it has several open source projects online. The package I have been bench testing on my linux laptop and having success with is:

However, since this is a mobile robot, there is always a concern about conserving battery power… Thus it would be ideal to not have the arm powered at all, while it is in its latched (stowed or travel) position, and only put power to it when it is needed.

Is there a way to do this with a ROS service? Use a ROS service that responds to a keyboard input and then will use the RPi GPIO to turn on a relay (solid state, or electromechanical)? I saw and tried a ROS example that turned an LED on/off whether a pushbutton was pressed.

Also, once power has been applied to the arm, and ideally it is still stowed since all the base arduino code has the stowed position set initially, how can I call the github package that I posted above? Is there a way for a ROS service to call a launch file??

Thanks again for the responses so far. I am learning so much everyday!

Well the thing with the Pi is that there’s usually some central process that runs the GPIO. So if you’re running a more recent version of the pi_sonar node you’ll likely have it set up via the pigpio daemon, which can be used by other processes as well. There are lots of both python and c++ examples all over the web on how to accomplish that, there’s nothing too ROS specific about it, except calling the correct function once the correct message is received by a listener.

Another more standalone way to do it is with kernel interfaces, which sounds complicated but it’s actually just writing values into a virtual file which sets up pins and reads/writes to them. Given that you don’t need pwm or anything fancy for a relay that would probably be the more robust way to go.