Download the source code package and compile it in Ubuntu

Download the source code package and compile it in Ubuntu

In the process of learning to use Ubuntu, you will inevitably try to run other people's code. At this time, you need to know how to download the source code, compile and run it.
This article is related to the following two blogs:
ROS workspace and function package
ROS implementation code and compiled code running steps

text

  1. After downloading the source code package from Github, copy it to Ubuntu, as shown in the figure of the Unity-Robotics-Hub source code package
    Insert image description here
    . There is a series of codes related to the pick_and_place function in the process. Here, only the ROS code is taken. As shown in the figure, there are five packages: moveit_msgs, niryo_moveit, niryo_one_ros, niryo_one_urdf, ros_tcp_endpoint.

  2. Create a new folder as a new workspace. (It can also be used with the workspace where the previously used package is located)
    I named it catkin_ws_ROS here
    Insert image description here

  3. Then create a new folder named src to store the package
    Insert image description here

  4. Put the five packages mentioned earlier into the src folder created in the previous step.
    Insert image description here

  5. Then return to the catkin_ws_ROS directory, open the terminal, and enter

catkin_make
  1. After compilation is completed, update the environment variables.
    Use ctrl+H to display hidden files in the interface .bashrc
    . After entering the text, add
source ~/catkin_ws_ROS/devel/setup.bash

Reopen the terminal to update the environment variables

Errors encountered during compilation and their solutions

At first, we planned to put the function package mentioned above directly into catkin_ws for compilation, but we encountered some problems.

The first question
The specified base path “/home/vm123/catkin_ws” contains a CMakeLists.txt but “catkin_make” must be invoked in the root of workspace is
Insert image description here
solved by referring to the following URL:
https://answers.ros.org/question/ 252980/catkin_make-fail-must-be-invoked-in-the-root-of-workspace/
hyperlink

The second problem
The build space at '/home/vm123/catkin_ws/build' was previously built by 'catkin build'. Please remove the build space or pick a different build space. Please refer to the following URL to solve it: https://
Insert image description here
blog
. csdn.net/qq_42735696/article/details/112801451Hyperlink——————————————Copyright Statement : This article is
an original article by CSDN blogger “qq_42735696” and follows CC 4.0 BY-SA Copyright agreement, please attach the original source link and this statement when reprinting. Original link: https://blog.csdn.net/qq_42735696/article/details/112801451


Guess you like

Origin blog.csdn.net/m0_64730542/article/details/127721304