This code includes the control interface program built by Qt and the program package for the UR5 robotic arm Gazebo simulation configuration. Before using this code, please make sure you have properly installed ROS and Qt5. The following are specific instructions:
The following is a demonstration video connection: https://v.qq.com/x/page/g3314gplj82.html?n_version=2021
1.RobotDescription and RobotGazebo
These are two ROS function packages, modified according to UR official documents. The former is the UR5 robotic arm and the related model description files of the console and camera. The latter is the related configuration of Gazebo, including the setting of ros_control and the start of the Gazebo simulation environment. launch file.
Please note that for follow-up convenience, ros_control only uses the JointPositionGroupController in the official document. In addition, you need to create a ROS workspace to store these two functional packages. You can start Robot.launch under RobotGazebo to open the Gazebo simulation environment.
2.RosCommunicationLib
For the convenience of subsequent interface design, a class named RosCommnication is defined in this file to facilitate subscribing and sending related messages in ROS. This class implements the release of joint angle control commands to UR5 in Gaezbo and the subscription to UR5 joint angles. Information and subscription of two camera image information in the simulation environment. For details on how to use this class, please refer to test_RosCommunication.cpp.
Please note that this class has been compiled into a dynamic library named libRosCommunicationLib.so and saved in the /lib directory. At the same time, the executable file generated by test_RosCommunication.cpp is saved in the /bin directory. In addition, the compilation of the entire directory needs to depend on the ROS-related libraries. For the specific compilation configuration, please refer to the CMakeLists.txt document.
3.RobotControlInterface
The Qt interface program contains two ui files, the main interface and the camera interface.
Note that the compilation of this program not only depends on the ROS library, but also depends on the header files in the include directory in the above RosCommunicationLib and the libRosCommunicationLib.so library file, so you need to add the include_directories in the CMakeLists.txt in this directory And change the path of the above two files in target_link_libraries to the storage path of the above two files on your computer.
本代码包含通过Qt搭建的控制界面程序以及UR5机械臂Gazebo仿真配置的程序包。 在使用本代码之前,请确保你已经正确安装好了ROS以及Qt5。 以下为具体说明:
1.RobotDescription和RobotGazebo
这是两个ROS功能包,根据UR官方文档进行了修改,前者为UR5机械臂以及操作台和摄像头的相关模型描述文件,后者为Gazebo的相关配置,包括ros_control的设置以及启动Gazebo仿真环境的launch文件。
请注意,为了后续方便,ros_control只采用了官方文档中的JointPositionGroupController。此外,你需要创建一个ROS工作空间来存放这两个功能包,你可以启动RobotGazebo下的Robot.launch来打开Gazebo仿真环境。
2.RosCommunicationLib
为了后续界面设计的方便,该文件中定义了一个名为RosCommnication的类以方便在ROS中订阅和发送相关消息,该类实现了向Gaezbo中的UR5发布关节角度的控制命令以及订阅UR5的关节角度信息和订阅仿真环境中的两个摄像头图像信息。具体如何使用该类可参考test_RosCommunication.cpp。
请注意,该类已经被编译为了名为libRosCommunicationLib.so的动态库并被保存在了/lib目录下,同时,test_RosCommunication.cpp生成的可执行文件被保存在了/bin目录下。另外,整个目录的编译需要依赖于ROS相关库,具体编译配置详见CMakeLists.txt文档。
3.RobotControlInterface
Qt界面程序,包含两个ui文件分别是主界面以及摄像头界面。
注意,该程序的编译除了需要依赖于ROS库之外,也需要依赖于上述RosCommunicationLib中的include目录中的头文件以及libRosCommunicationLib.so库文件,因此你需要把该目录下的CMakeLists.txt中的include_directories以及target_link_libraries中关于上述两个文件的路径更改为你电脑上上述两个文件的存储路径。