# The following lines of boilerplate have to be in your project's # CMakeLists in this exact order for cmake to work correctly cmake_minimum_required(VERSION 3.5) include($ENV{IDF_PATH}/tools/cmake/project.cmake) if(DEFINED ENV{RMAKER_PATH}) set(RMAKER_PATH $ENV{RMAKER_PATH}) else() set(RMAKER_PATH ${CMAKE_CURRENT_LIST_DIR}/../../components/esp-rainmaker) message("-- Not find RMAKER_PATH, default is ${RMAKER_PATH}") endif(DEFINED ENV{RMAKER_PATH}) set(EXTRA_COMPONENT_DIRS ../../components $ENV{IDF_PATH}/examples/common_components/led_strip ${RMAKER_PATH}/components ) add_compile_options(-fdiagnostics-color=always) project(factory_demo)
时间: 2024-04-16 07:24:53 浏览: 36
这是一个CMakeLists.txt文件的示例,它用于构建一个名为"factory_demo"的项目。首先,它设置了所需的CMake版本为3.5。然后,它包含了一个名为"project.cmake"的文件,该文件位于环境变量"IDF_PATH"指定的路径下。
接下来,它检查是否定义了环境变量"RMAKER_PATH"。如果已定义,则将其值设置为"RMAKER_PATH"变量;否则,将其设置为当前列表目录的相对路径下的"../../components/esp-rainmaker"。同时,它会打印一条消息来指示未找到"RMAKER_PATH"时使用的默认值。
然后,它设置了额外的组件目录,包括"../../components"、"$ENV{IDF_PATH}/examples/common_components/led_strip"和"${RMAKER_PATH}/components"。
最后,它通过"add_compile_options"函数添加了一个编译选项"-fdiagnostics-color=always"。
这个CMakeLists.txt文件用来配置和构建一个名为"factory_demo"的项目。
相关问题
In Java 7, it is possible to write ArrayList<>, for example, with no type specified for the elements. Give an example of a situation in which this is allowed and explain why it is allowed?
In Java 7 and later versions, it is possible to use the diamond operator `<>` to specify the type of a generic class with the type inference feature. For example, instead of writing `ArrayList<String>`, we can write `new ArrayList<>()` and the compiler will infer that it is an `ArrayList<String>` based on the context.
Here is an example of how the diamond operator can be used:
```
List<String> list = new ArrayList<>();
list.add("apple");
list.add("banana");
List<String> copy = new ArrayList<>(list); // diamond operator used for type inference
```
In this example, the `ArrayList` constructor is called with no type specified for the elements. However, the compiler is able to infer the type of the `ArrayList` based on the type of the `list` variable, which is a `List<String>`. Therefore, the `copy` variable is also inferred to be a `List<String>`.
The diamond operator is allowed in situations where the type of the generic class can be inferred from the context. This includes cases where the type is specified in the variable declaration or method signature, or where the generic class is being used in a method call with an argument of a specific type. By allowing the diamond operator, Java reduces the amount of boilerplate code needed to use generic classes and makes the code more concise and readable.
ubuntu 18.04ros安装ros_control_boilerplate
1. 安装ROS
在Ubuntu 18.04上安装ROS,可以按照ROS官方文档的指导进行操作,具体步骤如下:
1)设置软件源
```bash
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
```
2)添加ROS公钥
```bash
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
```
3)安装ROS
```bash
sudo apt update
sudo apt install ros-melodic-desktop-full
```
4)初始化rosdep
```bash
sudo rosdep init
rosdep update
```
5)设置环境变量
```bash
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
```
2. 安装ros_control_boilerplate
安装ros_control_boilerplate可以使用ROS的包管理工具catkin,具体步骤如下:
1)创建catkin工作空间
```bash
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/
catkin_make
```
2)下载ros_control_boilerplate源码
```bash
cd ~/catkin_ws/src
git clone https://github.com/PickNikRobotics/ros_control_boilerplate.git
```
3)安装依赖
```bash
sudo apt install ros-melodic-controller-manager ros-melodic-gazebo-ros-control
rosdep install --from-paths . --ignore-src --rosdistro melodic
```
4)编译
```bash
cd ~/catkin_ws/
catkin_make
```
5)设置环境变量
```bash
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
```
3. 使用ros_control_boilerplate
安装完成后,可以通过以下命令启动ros_control_boilerplate:
```bash
roslaunch ros_control_boilerplate gazebo.launch
```
该命令会启动Gazebo仿真环境,并加载ros_control_boilerplate的控制器,可以通过RViz进行控制。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)