ROS environment variable access¶
The environment APIs of rospkg
provide convenient access to ROS
package-related environment variables, including methods that provide
default values when environment variable overrides are not active.
-
rospkg.environment.
ROS_PACKAGE_PATH
¶ Name of
ROS_PACKAGE_PATH
environment variable.
-
rospkg.environment.
ROS_ROOT
¶ Name of
ROS_ROOT
environment variable.
-
rospkg.environment.
ROS_HOME
¶ Name of
ROS_HOME
environment variable.
-
rospkg.environment.
ROS_LOG_DIR
¶ Name of
ROS_LOG_DIR
environment variable.
-
rospkg.environment.
ROS_TEST_RESULTS_DIR
¶ Name of
ROS_TEST_RESULTS_DIR
environment variable.
-
rospkg.environment.
ROS_ETC_DIR
¶ Name of
ROS_ETC_DIR
environment variable.
-
get_ros_paths
([env=None]) → [str]¶ Get an ordered list of ROS paths to search for ROS packages, stacks, and other resources. This is generally computed from
ROS_ROOT
andROS_PACKAGE_PATH
.Parameters: env – override environment dictionary
-
get_ros_root
([env=None]) → str¶ Get the current
ROS_ROOT
. NOTE: it is preferable to callget_ros_paths()
instead of directly querying ROS environment variable values.Parameters: env – override environment dictionary
-
get_ros_package_path
([env=None])¶ Get the current
ROS_PACKAGE_PATH
. NOTE: it is preferable to callget_ros_paths()
instead of directly querying ROS environment variable values.Parameters: env – (optional) environment override.
-
get_ros_home
([env=None]) → str¶ Get directory location of
.ros
directory (akaROS_HOME
). possible locations for this. TheROS_HOME
environment variable has priority. IfROS_HOME
is not set,$HOME/.ros/log
is used.Parameters: env – override environment dictionary Returns: path to use use for log file directory
-
get_log_dir
([env=None]) → str¶ Get directory to use for writing log files. There are multiple possible locations for this. The
ROS_LOG_DIR
environment variable has priority. If that is not set, thenROS_HOME
/log is used. IfROS_HOME
is not set,$HOME/.ros/log
is used.Parameters: env – override environment dictionary Returns: path to use use for log file directory
-
get_test_results_dir
(env=None) → str¶ Get directory to use for writing test result files. There are multiple possible locations for this. The
ROS_TEST_RESULTS_DIR
environment variable has priority. If that is set,ROS_TEST_RESULTS_DIR
is returned. IfROS_TEST_RESULTS_DIR
is not set, thenROS_HOME
/test_results is used. IfROS_HOME
is not set,$HOME/.ros/test_results
is used.Parameters: env – override environment dictionary Returns: path to use use for log file directory
-
on_ros_path
(p[, env=None]) → bool¶ Check to see if filesystem path is on paths specified in ROS environment (
ROS_ROOT
,ROS_PACKAGE_PATH
).Parameters: p – path, str
Returns: True if p is on the ROS path (ROS_ROOT, ROS_PACKAGE_PATH)
-
get_etc_ros_dir
([env=None]) → str¶ Get directory location of
/etc/ros
directory. TheROS_ETC_DIR
environment variable has priority. IfROS_ETC_DIR
is not set,/etc/ros
is used.Parameters: env – override environment dictionary Returns: path to use use for log file directory