鱼香ROS社区
    • 版块
    • 最新
    • 未解决
    • 已解决
    • 群组
    • 注册
    • 登录
    紧急通知:禁止一切关于政治&VPN翻墙等话题,发现相关帖子会立马删除封号
    提问前必看的发帖注意事项: 社区问答规则(小鱼个人)更新 | 高质量帖子发布指南

    安装ros2后由于ros与ros2共存导致source install/setup.bash失败的问题

    已定时 已固定 已锁定 已移动 已解决
    综合问题
    ros2 版本冲突
    2
    18
    2.1k
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • 小鱼小
      小鱼 技术大佬 @2418760838
      最后由 编辑

      @2418760838 注意第119行,你把一个ros1的工作空间加入了bashrc

      新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

      24187608382 1 条回复 最后回复 回复 引用 0
      • 24187608382
        ※辰坤星宇 @小鱼
        最后由 编辑

        我把119行注释掉了,再去source可还是一样

        小鱼小 1 条回复 最后回复 回复 引用 0
        • 小鱼小
          小鱼 技术大佬 @2418760838
          最后由 编辑

          @2418760838 你在bashrc中保留的应该是foxy版本,但你source的应该是ros1的工作空间吧。

          新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

          24187608382 1 条回复 最后回复 回复 引用 0
          • 24187608382
            ※辰坤星宇 @小鱼
            最后由 编辑

            @小鱼 不是呀,就是按照小鱼老师教程中3.4.1节中做的,用ros2 pkg创建的功能包,在那个工作空间目录下source的

            小鱼小 1 条回复 最后回复 回复 引用 0
            • 小鱼小
              小鱼 技术大佬 @2418760838
              最后由 编辑

              @2418760838 你补充一下你目前的bashrc(复制粘贴代码快包括),和source之后的错误提示

              新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

              24187608382 4 条回复 最后回复 回复 引用 0
              • 24187608382
                ※辰坤星宇 @小鱼
                最后由 编辑

                此回复已被删除!
                1 条回复 最后回复 回复 引用 0
                • 24187608382
                  ※辰坤星宇 @小鱼
                  最后由 小鱼 编辑

                  @小鱼

                  # ~/.bashrc: executed by bash(1) for non-login shells.
                  # see /usr6/doc/bash/examples×artup-files (in the package bash-doc)
                  # for examples
                  
                  # If not running interactively, don't do anything
                  case $- in
                      *i*) ;;
                        *) return;;
                  esac
                  
                  # don't put duplicate lines or lines starting with space in the history.
                  # See bash(1) for more options
                  HISTCONTROL=ignoreboth
                  
                  # append to the history file, don't overwrite it
                  shopt -s histappend
                  
                  # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
                  HISTSIZE=1000
                  HISTFILESIZE=2000
                  
                  # check the window size after each command and, if necessary,
                  # update the values of LINES and COLUMNS.
                  shopt -s checkwinsize
                  
                  # If set, the pattern "**" used in a pathname expansion context will
                  # match all files and zero or more directories and subdirectories.
                  #shopt -s globstar
                  
                  # make less more friendly for non-text input files, see lesspipe(1)
                  [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/binš lesspipe)"
                  
                  # set variable identifying the chroot you work in (used in the prompt below)
                  if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
                      debian_chroot=$(cat /etc/debian_chroot)
                  fi
                  
                  # set a fancy prompt (non-color, unless we know we "want" color)
                  case "$TERM" in
                      xterm-color|*-256color) color_prompt=yes;;
                  esac
                  
                  # uncomment for a colored prompt, if the terminal has the capability; turned
                  # off by default to not distract the user: the focus in a terminal window
                  # should be on the output of commands, not on the prompt
                  #force_color_prompt=yes
                  
                  if [ -n "$force_color_prompt" ]; then
                      if [ -x /usr/binut ] && tput setaf 1 >&/dev/null; then
                  	# We have color support; assume it's compliant with Ecma-48
                  	# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
                  	# a case would tend to support setf rather than setaf.)
                  	color_prompt=yes
                      else
                  	color_prompt=
                      fi
                  fi
                  
                  if [ "$color_prompt" = yes ]; then
                      PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
                  else
                      PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
                  fi
                  unset color_prompt force_color_prompt
                  
                  # If this is an xterm set the title to user@host:dir
                  case "$TERM" in
                  xterm*|rxvt*)
                      PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
                      ;;
                  *)
                      ;;
                  esac
                  
                  # enable color support of ls and also add handy aliases
                  if [ -x /usr/bin/dircolors ]; then
                      test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
                      alias ls='ls --color=auto'
                      #alias dir='dir --color=auto'
                      #alias vdir='vdir --color=auto'
                  
                      alias grep='grep --color=auto'
                      alias fgrep='fgrep --color=auto'
                      alias egrep='egrep --color=auto'
                  fi
                  
                  # colored GCC warnings and errors
                  #export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
                  
                  # some more ls aliases
                  alias ll='ls -alF'
                  alias la='ls -A'
                  alias l='ls -CF'
                  
                  # Add an "alert" alias for long running commands.  Use like so:
                  #   sleep 10; alert
                  alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
                  
                  # Alias definitions.
                  # You may want to put all your additions into a separate file like
                  # ~/.bash_aliases, instead of adding them here directly.
                  # See /usr6/doc/bash-doc/examples in the bash-doc package.
                  
                  if [ -f ~/.bash_aliases ]; then
                      . ~/.bash_aliases
                  fi
                  
                  # enable programmable completion features (you don't need to enable
                  # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
                  # sources /etc/bash.bashrc).
                  if ! shopt -oq posix; then
                    if [ -f /usr6/bash-completion/bash_completion ]; then
                      . /usr6/bash-completion/bash_completion
                    elif [ -f /etc/bash_completion ]; then
                      . /etc/bash_completion
                    fi
                  fi
                  
                  # source ~/catkin_ws/develtup.bash
                  
                  
                  
                  # >>> fishros initialize >>>
                  echo "ros:foxy(1) noetic(2) ?"
                  read choose
                  case $choose in
                  1) source  /opt/ros/foxytup.bash;;
                  2) source  /opt/ros^etictup.bash;;
                  esac
                  # <<< fishros initialize <<<
                  
                  1 条回复 最后回复 回复 引用 0
                  • 24187608382
                    ※辰坤星宇 @小鱼
                    最后由 编辑

                    @小鱼 啊这,怎么字又大又小,井号注释符也消失了

                    小鱼小 1 条回复 最后回复 回复 引用 0
                    • 24187608382
                      ※辰坤星宇 @小鱼
                      最后由 编辑

                      @小鱼
                      jin@jin-virtual-machine:~/桌面/towm_ws$ source install/setup.bash
                      ROS_DISTRO was set to 'foxy' before. Please make sure that the environment does not mix paths from different distributions.
                      ROS_DISTRO was set to 'noetic' before. Please make sure that the environment does not mix paths from different distributions.

                      小鱼小 1 条回复 最后回复 回复 引用 0
                      • 小鱼小
                        小鱼 技术大佬 @2418760838
                        最后由 编辑

                        @2418760838 建议学一下markdown语法

                        新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

                        24187608382 1 条回复 最后回复 回复 引用 0
                        • 小鱼小
                          小鱼 技术大佬 @2418760838
                          最后由 编辑

                          @2418760838 打开心终端会提示ros:foxy(1) noetic(2) ?吗?

                          这个符号看起来很奇怪

                          1) source  /opt/ros/foxytup.bash;;
                          2) source  /opt/ros^etictup.bash;;
                          

                          新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

                          24187608382 1 条回复 最后回复 回复 引用 0
                          • 24187608382
                            ※辰坤星宇 @小鱼
                            最后由 编辑

                            @小鱼 会的,然后我输入foxy或者noetic就可以继续了

                            小鱼小 1 条回复 最后回复 回复 引用 0
                            • 24187608382
                              ※辰坤星宇 @小鱼
                              最后由 编辑

                              @小鱼 好的,我去了解一下

                              1 条回复 最后回复 回复 引用 0
                              • 小鱼小
                                小鱼 技术大佬 @2418760838
                                最后由 编辑

                                @2418760838 你应该输入1或者2,而不是版本的名称

                                新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

                                24187608382 1 条回复 最后回复 回复 引用 0
                                • 24187608382
                                  ※辰坤星宇 @小鱼
                                  最后由 编辑

                                  @小鱼 输了1还是一样

                                  小鱼小 1 条回复 最后回复 回复 引用 0
                                  • 小鱼小
                                    小鱼 技术大佬 @2418760838
                                    最后由 编辑

                                    @2418760838 将你的工作空间除src外删除后再次编译

                                    新书配套视频:https://www.bilibili.com/video/BV1GW42197Ck/

                                    24187608382 1 条回复 最后回复 回复 引用 0
                                    • 24187608382
                                      ※辰坤星宇 @小鱼
                                      最后由 编辑

                                      @小鱼 !不会报错了!谢谢小鱼老师

                                      1 条回复 最后回复 回复 引用 0
                                      • 24187608382 2418760838 将这个主题标记为已解决,在
                                      • 第一个帖子
                                        最后一个帖子
                                      皖ICP备16016415号-7
                                      Powered by NodeBB | 鱼香ROS