问题描述:

因为系统18.04所以 使用了docker 运行humble

下面过程均在docker下操作

1.配置好依赖后  使用 colcon build 编译好了dev_ws 。 输入ros2 run learning_node node_helloworld命令但是提示 找不到learning_node 。

2.输入 source install/local_setup.sh 命令后可以执行 ros2 run learning_node node_helloworld。不断打印helloworld。

3.之后执输入 echo " source ~/dev_ws/install/local_setup.sh" >> ~/.bashrc  想把环境变量写入bashrc 文件 但是发现无法写入

4.之后手动在.bashrch中添加source ~/dev_ws/install/local_setup.sh  后 执行ros2 run learning_node node_helloworld  还是无法找到learning_node , 推断环境变量没有加入成功。

问题:如何把 dev_ws/install/local_setup.sh  加入到docker环境变量中 以便在其他terminal中不用再次设置环境变量