Robotics StackExchange | Archived questions

How to run another script from within SMACH?

I've recently created a state machine using SMACH. This operates in its own directory. I have a separate Sim with its own scripts in its own sourced directory that can run ROS Actions (things like move forward, move back, etc.). I have already built the state machine in SMACH. I simply want it to run a ROS Action script for the Sim when a certain condition is met. Right now it just prints a line of text.

I just don't know how what to write in my SMACH script to make the script in the distant directory run. I've tried moving the script into my SMACH directory but it has a LOT of its own dependencies and I'd rather not rewrite all of that code. That would be a disaster.

If I can just call it from a distant directory that would be ideal.

I've tried import, service, exec, but nothing seems to work. Any ideas?

Thanks!

Asked by elrosito on 2022-10-11 01:58:16 UTC

Comments

Answers