-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Update Building-ROS2-Package-with-eclipse-2021-06.rst #6573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
shahryar-mooraj
wants to merge
1
commit into
ros2:lyrical
Choose a base branch
from
shahryar-mooraj:patch-1
base: lyrical
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,113 +2,49 @@ | |
|
|
||
| Tutorials/Building-ROS2-Package-with-eclipse-2021-06 | ||
|
|
||
| Building a package with Eclipse 2021-06 | ||
| ======================================= | ||
| Building a package with VS Code (Windows 11) or Eclipse | ||
| ======================================================= | ||
|
|
||
| .. contents:: Table of Contents | ||
| :depth: 2 | ||
| :local: | ||
|
|
||
| You cannot create a ROS 2 package with eclipse, you need to create it with commandline tools. | ||
| Follow the :doc:`Create a package <../Beginner-Client-Libraries/Creating-Your-First-ROS2-Package>` tutorial. | ||
| .. warning:: | ||
|
|
||
| After you created your project, you can edit the source code and build it with eclipse. | ||
| **Important Note for Windows 11 Users:** | ||
| The Eclipse CDT indexer is currently incompatible with the isolated Pixi/MSVC environment used in Lyrical Luth. Windows users should follow the **VS Code Setup** below instead of the Eclipse instructions. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, ok, this makes more sense now. |
||
|
|
||
| We start eclipse and select a eclipse-workspace. | ||
| VS Code Setup (Recommended for Windows 11) | ||
| ------------------------------------------ | ||
|
|
||
| .. image:: images/eclipse_work_dir.png | ||
| :target: ../../_images/eclipse_work_dir.png | ||
| :alt: eclipse_work_dir | ||
| To achieve a functional development environment on Windows 11 with Pixi, follow these steps: | ||
|
|
||
| We create a C++ project | ||
| 1. **Launch VS Code from the Pixi Shell** | ||
| To ensure the IDE inherits the necessary environment variables (MSVC compiler and ROS 2 paths), launch it from an active terminal: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| .. image:: images/eclipse_create_c++_project.png | ||
| :target: ../../_images/eclipse_create_c++_project.png | ||
| :alt: eclipse_create_c++_project | ||
| cd C:\dev\my_project_ws | ||
| pixi shell --manifest-path C:\dev\lyrical\pixi.toml | ||
| code . | ||
|
|
||
| 2. **Install Extensions** | ||
| Install the official **C/C++ Extension Pack** by Microsoft for IntelliSense and code navigation. | ||
|
|
||
| .. image:: images/eclipse_c++_project_select_type.png | ||
| :target: ../../_images/eclipse_c++_project_select_type.png | ||
| :alt: eclipse_c++_project_select_type | ||
| 3. **Configure the Compiler Path** | ||
| * Open the Command Palette (``Ctrl+Shift+P``) and select **C/C++: Edit Configurations (UI)**. | ||
| * Set the **Compiler path** to your global MSVC executable: | ||
| ``C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/[version]/bin/Hostx64/x64/cl.exe`` | ||
| * Set the **IntelliSense mode** to ``windows-msvc-x64``. | ||
|
|
||
| We see that we got C++ includes. | ||
| 4. **Add Recursive Include Paths** | ||
| In the same UI menu, add these paths to the **Include path** section using recursive notation (``/**``) to resolve nested ROS 2 headers: | ||
|
|
||
| .. image:: images/eclipse_c++_project_includes.png | ||
| :target: ../../_images/eclipse_c++_project_includes.png | ||
| :alt: eclipse_c++_project_includes | ||
| * ``${workspaceFolder}/**`` [cite: 3314] | ||
| * ``C:/dev/lyrical/rolling/install/include/**`` [cite: 3314] | ||
| * ``C:/dev/lyrical/.pixi/envs/default/Library/include/**`` [cite: 3314] | ||
|
|
||
| Eclipse Setup (Linux Only) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we keep this I don't think we need these last three lines. |
||
| -------------------------- | ||
|
|
||
| We now import our ROS 2 project. | ||
| The code is still in the old place. | ||
|
|
||
| .. image:: images/eclipse_import_project.png | ||
| :target: ../../_images/eclipse_import_project.png | ||
| :alt: eclipse_import_project | ||
|
|
||
| .. image:: images/eclipse_import_filesystem.png | ||
| :target: ../../_images/eclipse_import_filesystem.png | ||
| :alt: eclipse_import_filesystem | ||
|
|
||
| Click the Advanced in the Options and check the **Create links in worksapce**. | ||
|
|
||
| .. image:: images/eclipse_import_select_my_package.png | ||
| :target: ../../_images/eclipse_import_select_my_package.png | ||
| :alt: eclipse_import_select_my_package | ||
|
|
||
|
|
||
|
|
||
| We see in the source code that the C++ includes got resolved but not the ROS 2 ones. | ||
|
|
||
| .. image:: images/eclipse_c++_wo_ros_includes.png | ||
| :target: ../../_images/eclipse_c++_wo_ros_includes.png | ||
| :alt: eclipse_c++_wo_ros_includes | ||
|
|
||
|
|
||
| .. image:: images/eclipse_c++_path_and_symbols.png | ||
| :target: ../../_images/eclipse_c++_path_and_symbols.png | ||
| :alt: eclipse_c++_path_and_symbols | ||
|
|
||
| Add include paths of needed packages. | ||
| (e.g. **/opt/ros/iron/include/rclcpp**, **/opt/ros/iron/include/std_msgs**, etc.) | ||
|
|
||
| .. image:: images/eclipse_c++_add_directory_path.png | ||
| :target: ../../_images/eclipse_c++_add_directory_path.png | ||
| :alt: eclipse_c++_add_directory_path | ||
|
|
||
|
|
||
| We now see that the ROS 2 includes got resolved too. | ||
|
|
||
| .. image:: images/eclipse_c++_indexer_ok.png | ||
| :target: ../../_images/eclipse_c++_indexer_ok.png | ||
| :alt: eclipse_c++_indexer_ok | ||
|
|
||
|
|
||
| Adding Builder colcon, so that we can build with right-click on project and "Build project". | ||
|
|
||
| .. image:: images/eclipse_c++_properties_builders.png | ||
| :target: ../../_images/eclipse_c++_properties_builders.png | ||
| :alt: eclipse_c++_properties_builders | ||
|
|
||
|
|
||
| .. image:: images/eclipse_c++_builder_main.png | ||
| :target: ../../_images/eclipse_c++_builder_main.png | ||
| :alt: eclipse_c++_builder_main | ||
|
|
||
|
|
||
| With PYTHONPATH you can also build python projects. | ||
|
|
||
| .. image:: images/eclipse_c++_builder_env.png | ||
| :target: ../../_images/eclipse_c++_builder_env.png | ||
| :alt: eclipse_c++_builder_env | ||
|
|
||
|
|
||
| .. image:: images/eclipse_c++_properties_builders_with_colcon.png | ||
| :target: ../../_images/eclipse_c++_properties_builders_with_colcon.png | ||
| :alt: eclipse_c++_properties_builders_with_colcon | ||
|
|
||
|
|
||
| Right-click on the project and select "Build Project". | ||
|
|
||
| .. image:: images/eclipse_c++_build_project_with_colcon.png | ||
| :target: ../../_images/eclipse_c++_build_project_with_colcon.png | ||
| :alt: eclipse_c++_build_project_with_colcon | ||
| *... [Original Eclipse instructions for Linux follow here] ...* | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MSCV 👍🏻
I don't know how I feel about adding Eclipse here, personally, I think it should be one or the other.
@knmcguire can you weigh in here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the PR is mostly just to add the vscode option here that is more common to use now. It's been a really long time since I've used eclipse on windows (or even Ubuntu), so this is difficult to judge.
But the title has also changed to mention both of the setups, however I would like to add that many people on ubuntu also use vscode as well