ROS系统开发中使用Qt Creator 作为IDE

管理catkin_make项目

使用Qt Creator 管理catkin_make项目,可以更加系统地开发代码包。

1、安装并打开Qt Creator

本文中使用的是Qt Creator 3.5.1,基于Qt 5.5.1和 GCC 5.2.1。
注意,要在终端中打开Qt Creator,不然会报错如下

//直接双击打开Qt Creator
find_package(catkin) failed.  catkin was neither found in the workspace nor in the CMAKE_PREFIX_PATH. One reason may be that no ROS setup.sh was sourced before.

终端中打开Qt Creator ,可以解决以上问题。

//在终端打开Qt Creator
slam-nuc@slam-nuc:~$  qtcreator

2、导入已有的catkin_make项目

  1. 将符号链接的CMakeLists.txt 文件替换为实体文件
slam-nuc@slam-nuc:~$ cd ~/catkin_ws_testqt/src   | sed -i '' CMakeLists.txt 
  1. 使用 Qt Creator中的 Open Project命令 ,打开catkin工作区的最高级CMakeLists.txt 文件。
    在这里插入图片描述
  2. 设置CMake构建路径为
~/catkin_ws_testqt/build

在这里插入图片描述

  1. 设置执行CMake的相关参数为
-DCMAKE_INSTALL_PREFIX=../install -DCATKIN_DEVEL_PREFIX=../devel

点击执行CMake,如果按之前的操作做完的话,这一步是不会出错的,直接通过。
6. 此时已经将整个catkin_make项目加入到Qt Creator中,可以方便的管理项目。
在这里插入图片描述

注意,如果没有看到项目,需要在视图中选择项目即可。
在这里插入图片描述

3、使用root身份进行编译和调试

  1. 使用su命令,获取root权限,进行编译通过。
slam-nuc@slam-nuc:~/catkin_ws_testqt$ su root
密码: 
root@slam-nuc:/home/slam-nuc/catkin_ws_testqt# qtcreator

在这里插入图片描述

  1. 赋予普通用户root权限

添加用户,首先用adduser命令添加一个普通用户,命令如下:

slam-nuc@slam-nuc:~/catkin_ws_testqt$ sudo adduser haorui   //添加一个名为claire的用户

slam-nuc@slam-nuc:~/catkin_ws_testqt$ sudo passwd haorui  //change the password


changing password for user haorui

New unix password :  //input new password

Retype new unix password:  //input the new password again


password:all authentication tokens updated successfully.

赋予root 权限

slam-nuc@slam-nuc:~/catkin_ws_testqt$ sudo gedit /etc/sudoers 
//找到%wheel 一行,把前面的注释(#)去掉

##Allow people in group wheel to run all commands

%wheel  ALL=(ALL)   ALL

//然后修改用户,使其属于root组(wheel),命令如下:

root   ALL=(ALL)  ALL

haorui  ALL=(ALL)  ALL

slam-nuc@slam-nuc:~/catkin_ws_testqt$ sudo usermod -g root haorui

修改完毕后,现在可以用haorui账号登陆,然后用sudo su haorui ,即可获得root权限进行操作。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

IT兔

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值