0

Rosanswers logo

I have a launch file which runs some nodes on a remote machine. I declare the remote machine as follows:

  <machine name="petra" address="petra" env-loader="/home/paul/catkin_ws/devel_isolated/env.sh"/>

and launch a remote node with:

  <node machine="petra" name="myspeech.py" pkg="speech_infinite" type="myspeech.py" output="screen"/>

The node uses Google cloud speech API and requires an environment variable of the form:

export GOOGLE_APPLICATION_CREDENTIALS=/home/paul/Programs/GoogleAccount/myproject-blahblah.json

Currently I edit env.sh in devel_isolated, but that gets overwritten when I make the workspace.

I have traced through the shell scripts, which include other scripts, which include other scripts and hooks etc. It left my head spinning ! Can anyone suggest a good way(i.e. minimal changes to ROS boilerplate) to set this up, so that:

  1. The Google credentials are included even after remaking catkin workspace
  2. All the rest of my catkin environment continues to be loaded.

Originally posted by elpidiovaldez on ROS Answers with karma: 142 on 2021-07-02

Post score: 0

1 Answers1

0

Rosanswers logo

Tried using env-loader to just run a seperate bash script? You could source the "/home/paul/catkin_ws/devel_isolated/env.sh" from the other "start_script.sh" if necessary?

<node machine="petra" name="myspeech.py" pkg="speech_infinite" type="myspeech.py" env-loader="/suitable_directory/start_script.sh" output="screen"/>

Alternatively put the export in your /etc/profile or ~/.bashrc on the remote machine?


Originally posted by bob-ROS with karma: 525 on 2021-07-03

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by elpidiovaldez on 2021-07-03:
Thanks for your suggestion. It seems blindingly obvious now, but at the time I was reeling from trying to follow what was going on with all the indirection. I thought I had to go via the provided env file. Following your idea, I made a file on the remote machine ,called env.bash, which works perfectly:

#!/usr/bin/env bash

#This allows use of Google speech recognition and other cloud services. export GOOGLE_APPLICATION_CREDENTIALS="/home/paul/Programs/GoogleAccount/zen-speech-2bcd94a51876.json"

source /home/paul/catkin_ws/devel_isolated/setup.bash exec "$@"

The launch file contains:

<machine name="petra" address="petra" env-loader="/home/paul/catkin_ws/src/env.bash"/>