This is a bit of a shot in the dark since I don't know anything about your system, but if there is some topic that the motor is subscribed to (maybe throttle), then you can manipulate that. (If you're lucky, there might be a service you can call instead).
Find out what topics are there with rostopic list
, and if any look relevant, call rostopic info [/path/to/topic]
to see what's subscribed to it. Alternatively if you know the node, rosnode info [node]
will tell you what it's subscribed to.
You'll need to poke new values into the topic. If something is continuously publishing into the topic, you could change the publisher topic write your own node to act as a on/off valve. That is:
original_publisher(node) -> target_throttle(topic) -> throttle_on_off(node) -> actual_throttle(topic) -> original_subscriber(node)
You can do what you like with your node, such as stopping forwarding on the messages after 5s. You could possibly get away with not even subscribing to the target_throttle topic if you know what if should be.