ros-industrial / ros_qtc_plugin

ROS Qt Creator Plug-in (https://ros-qtc-plugin.readthedocs.io)
397 stars 214 forks source link

Does not support Qt Creator Device functionality #497

Open Levi-Armstrong opened 6 months ago

Levi-Armstrong commented 6 months ago

Qt Creator provides different devices to allow you to build code like on remote device, docker device, etc., but there a few things with this plugin which prevent it from being used with these types of devices. Any where in the plugin where we create a process for calling source to get environment variables, etc. need to be updated to use the device object for running these so they are compatible with Qt Creator device functionality.

Levi-Armstrong commented 6 months ago

@christianrauch what is the best way for me to build and test changes to the plugin on Ubuntu?

Levi-Armstrong commented 6 months ago

Another option is to just move away from using our build,run and clean steps and just use the Qt Creator built in Custom Process Step, which is what I am currently using to work around this along with the clangd plugin for code completion.

christian-rauch commented 6 months ago

@christianrauch what is the best way for me to build and test changes to the plugin on Ubuntu?

I updated the README in https://github.com/ros-industrial/ros_qtc_plugin/pull/498 with information on how to run Qt Creator with the plugin in Debug mode from the command line (section Build (Source)). You should just need to copy & paste the commands there. Take note of the Debug if you want to debug crashes etc.

Please have a look at the PR and let me know if this helps or if you need me to add more information.

Levi-Armstrong commented 6 months ago

Thank you, I will go through the process and let you know how it goes.

collinthornton commented 6 months ago

@Levi-Armstrong What's the process you're using to run a custom process in the docker environment? I put a bit of effort into running a Custom Process Stepwith /usr/lib/catkin build -cs in a docker container, but didn't get very far.

Levi-Armstrong commented 6 months ago

image

image

Also had to clear out addition environment variables because those are generated running a command on the host machine.

collinthornton commented 6 months ago

Thanks. What have you changed for the kit and/or device settings?

Levi-Armstrong commented 6 months ago
Levi-Armstrong commented 6 months ago

@christian-rauch What are your thoughts on removing our custom steps and just have the this populate the build and run with the necessary custom process steps? This may be better long term.

christian-rauch commented 6 months ago

At the moment we have a "Colcon Step" etc. that can be further extended with colcon or CMake arguments. Are you suggesting that we remove that and automatically create a custom step with a predefined command and arguments? How would we set the environment in this case? This would reduce the maintenance costs for updating the plugin API but it would prevent us from parsing the colcon output for progress.

marip8 commented 3 months ago

I'm also trying to build a project within a docker image with this plugin and am running into some issues. My docker device and corresponding kit seems to be set up correctly as far as I can tell.

First it seems like the provided Colcon Step for building (possibly) invokes my local instance of colcon and sets a lot of environment variables from my host computer rather than the docker image (e.g., PATH, AMENT_PREFIX_PATH, etc.). This makes my build fail because my host computer is on foxy and the docker image is on humble.

I tried using the custom process step to "manually" invoke colcon, but the build fails because it seems to be running this custom process on my local machine rather than the docker device. The build log shows that it doesn't think /opt/ros/humble is a real directory (it exists in the docker image, but not on my host machine) and that the failure happens because it can't find ROS2 packages. The build command and environment variables seem to correspond to the docker image, but it doesn't seem to run the custom process step within the docker image. Any ideas on how to fix or get around this?

Screenshot_2024-06-18_13-55-54

13:49:55: Starting: "/usr/bin/colcon" build --symlink-install
[0.462s] WARNING:colcon.colcon_ros.prefix_path.ament:The path '/opt/ros/humble' in the environment variable AMENT_PREFIX_PATH doesn't exist
Starting >>> cartesian_controller_base
Starting >>> cartesian_controller_utilities
--- stderr: cartesian_controller_base
CMake Error at CMakeLists.txt:30 (find_package):
  By not providing "Findament_cmake.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "ament_cmake", but CMake did not find one.

  Could not find a package configuration file provided by "ament_cmake" with
  any of the following names:

    ament_cmakeConfig.cmake
    ament_cmake-config.cmake

  Add the installation prefix of "ament_cmake" to CMAKE_PREFIX_PATH or set
  "ament_cmake_DIR" to a directory containing one of the above files.  If
  "ament_cmake" provides a separate development package or SDK, be sure it
  has been installed.

---
Failed   <<< cartesian_controller_base [0.05s, exited with code 1]
Aborted  <<< cartesian_controller_utilities [0.34s]

Summary: 0 packages finished [0.65s]
  1 package failed: cartesian_controller_base
  1 package aborted: cartesian_controller_utilities
  2 packages had stderr output: cartesian_controller_base cartesian_controller_utilities
  7 packages not processed
13:49:56: The process "/usr/bin/colcon" exited with code 1.
Levi-Armstrong commented 3 months ago

There are several things under the hood that run a process to get things like environment and other things which need to be updated to make the call through the device to fix the issue.

Levi-Armstrong commented 3 months ago

I think everything in the ros_utils.h/cpp take a QProcess and these need to be updated to leverage the active device.