Note: 本教程假设你已经完成了前面的教程:roch_bringupROS enviroment variablesHow to configure enviroment.
(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

修改Roch环境

Description: 查看和配置Roch的环境变量

Keywords: Roch环境变量

Tutorial Level: BEGINNER

Next Tutorial: Using package of roch_follower

Roch的环境

该教程假设你有一台Roch机器人并已经完成了配置。

现在,让我们查看Roch有多少环境变量。输入如下:

export | grep ROCH_

或者

env | grep ROCH_

在命令处理结束后,我们将会得到如下输出:

declare -x ROCH_3D_SENSOR="r200"
declare -x ROCH_3D_SENSOR_ENABLE="TRUE"
declare -x ROCH_3D_SENSOR_NAV_ENABLE="FALSE"
declare -x ROCH_BASE="roch"
declare -x ROCH_BATTERY
declare -x ROCH_DESCRIPTION="/home/carl/test_husky/src/roch_v106120170117172/roch_project/roch/roch_description/robots/roch_standard_asus_xtion_pro.urdf.xacro"
declare -x ROCH_GAZEBO_DESCRIPTION="/home/carl/test_husky/src/roch_v106120170117172/roch_project/roch_simulator/roch_gazebo/urdf/description.gazebo.xacro"
declare -x ROCH_GAZEBO_MAP_FILE="/home/carl/test_husky/src/roch_v106120170117172/roch_project/roch_simulator/roch_gazebo/maps/sawyer_playgen.yaml"
declare -x ROCH_GAZEBO_WORLD_FILE="/home/carl/test_husky/src/roch_v106120170117172/roch_project/roch_simulator/roch_gazebo/worlds/sawyer_playgen.world"
declare -x ROCH_INTERACTIONS_LIST="[roch_bringup/admin.interactions, roch_bringup/documentation.interactions, roch_bringup/pairing.interactions, roch_bringup/visualisation.interactions]"
declare -x ROCH_LASER="rplidar"
declare -x ROCH_LASER_ENABLE="FALSE"
declare -x ROCH_MAG_CONFIG=""
declare -x ROCH_MAP_FILE="/home/carl/test_husky/src/roch_v106120170117172/roch_project/roch/roch_navigation/maps/willow-2010-02-18-0.10.yaml"
declare -x ROCH_NAME="roch"
declare -x ROCH_RAPP_PACKAGE_BLACKLIST="[]"
declare -x ROCH_RAPP_PACKAGE_WHITELIST="[rocon_apps, roch_rapps]"
declare -x ROCH_SERIAL_PORT="/dev/roch"
declare -x ROCH_SIMULATION="false"
declare -x ROCH_STACKS="standard"
declare -x ROCH_TYPE="roch"

修改变量值

我们已经查看了Roch的环境变量,现在我们应该修改我们需要的值,例如将我不想使用r200,那么我们可以将ROCH_3D_SENSOR的变量值r200,改为我们需要的值或传感器xtion或者astra现在,有许多种方法来修改值。

命令行

我们可以使用如下的命令来修改我们不需要的值,像:修改ROCH_LASER值为ls01c。

export ROCH_LASER=ls01c

输入如下命令来查看:

env | grep ROCH_LASER

一旦你关闭当前终端,变量ROCH_LASER的值将会恢复为rplidar,所以,我们应该使用一种永久修改变量值的方法来防止其改变。

.bashrc文件

.bashrc文件是我们想要的,一旦你将变量值写入.bashrc文件,变量值将不会再改变,直到我们再次修改该文件。

使用你喜欢的编辑器打开~/.bashrc文件,例如gedit

gedit ~/.bashrc

.bashrc文件最后添加如下行:

export ROCH_BASE=roch
export ROCH_STACKS=standard
export ROCH_3D_SENSOR=r200      #for now have three support sensor [ asus_xtion_pro, kinect, r200]
export ROCH_LASER=ls01c                 #ls01c
export ROCH_3D_SENSOR_ENABLE=false
export ROCH_3D_SENSOR_NAV_ENABLE=false
export ROCH_LASER_ENABLE=true

关闭文件再次打开终端,使用如下命令查看:

env | grep ROCH_

Wiki: cn/roch/Tutorials/Changing env of roch (last edited 2017-03-01 09:08:44 by SawYer)