使用rufus制作ubuntu18.04 安装盘
插上U盘,USB启动,install ubuntu,中文,全选,其他选项,分区(重点)
手动分区,假设留出的空闲分区为 80G,点击空闲盘符,点击"+"进行分区,如下:
-
efi:大小500M,逻辑分区,空间起始位置,用于efi;
-
swap:8G,逻辑分区,空间起始位置,用于"swap"或"交换空间"。
-
/: 20G,主分区,空间起始位置,用于"ext4日志文件系统",挂载点为"/"。
-
/home:剩下的全分给它,逻辑分区,空间起始位置,用于"ext4日志文件系统",挂载点为"/home"。
下拉列表选择Ubuntu的efi分区编号,之后点击"Install Now"。
地区上海,默认英语键盘,姓名、计算机名、用户名、密码,安装,等待完成。
sudo cp /etc/apt/sources.list sources.list.old # 把以前的先保存一下
sudo vim /etc/apt/sources.list # 打开源文件配置进行换源,填写下面的阿里源
# ubuntu18.04阿里源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
sudo apt-get update # 填写进后保存,后续更新一下,就可以了
设置——网络——勾选所有。
- 安装
sudo apt-get install openssh-server
- 启动
sudo service ssh start
- 查询服务启动状态:
sudo ps -e | grep ssh
sudo systemctl enable ssh
sudo reboot
sudo systemctl status ssh
看到Active: active (running)即表示成功
下载Binary版(下载即用)(https://cmake.org/download/)
下载后将文件提取(解压)出来,复制到/usr/local/bin/
sudo cp -r /home/up/下载/cmake-3.23.1/ /usr/local/bin/
创建软链接,终端输入:
sudo ln -sf /usr/local/bin/cmake-3.23.1/bin/* /usr/local/bin/
查看cmake版本,另起终端输入:
cmake --version
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt-get update
sudo apt-get install ros-melodic-desktop-full # 根据ubuntu版本更改
sudo rosdep init
rosdep update
此处连接不上会报错,需要魔法。
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc # 根据ubuntu版本更改
source ~/.bashrc
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential
- 开启新终端输入以下命令,初始化ROS环境:
roscore
- 再打开一个新的终端(Termial),输入以下命令,弹出一个小乌龟窗口:
rosrun turtlesim turtlesim_node
- 出现一个小乌龟的LOGO后,再 打开一个新的终端(Termial),输入以下命令:
rosrun turtlesim turtle_teleop_key
- 打开新的Termial,输入以下命令,可以查看ROS节点信息:
rosrun rqt_graph rqt_graph
顺利完成以上步骤则安装成功。
(https://developer.dji.com/cn/) 创建OboardSDK的app获取app_id和app_key。
下载地址:https://github.co/dji-sdk/Onboard-SDK/tree/3.8.1
在OnboardSDK文件夹内打开终端输入:
mkdir build
cd build
cmake ..
make djiosdk-core
sudo make install djiosdk-core
此时若想运行例程或进行OSDK开发:
cp ../sample/linux/common/UserConfig.txt bin/
cd bin
gedit UserConfig.txt
将前面申请的app_id和app_key填入,波特率为230400,串口确定无误后,连接Dji Assistant 2,遥控器开启并切换F模式,可运行例程进行仿真:
./djiosdk-flightcontrol-sample UserConfig.txt
其他例程也可以试一试。
建立新终端,输入:
mkdir -p ~/catkin_ws/src
cd catkin_ws/src
catkin_init_workspace
下载地址:https://github.com/dji-sdk/Onboard-SDK-ROS/tree/3.8.1
把下载的OnboardSDK-ROS包解压到~/catkin_ws/src下,编译dji_sdk和dji_sdk_demo:
cd ~/catkin_ws
catkin_make
这里可能会失败,终端输入:
sudo apt-get install ros-melodic-nmea-msgs #根据ubuntu版本更改
重新输入:
catkin_make
完成后:
cd src/dji_sdk/launch/sdk.launch
gedit sdk.launch
将前面申请的app_id和app_key写入launch文件,修改波特率为230400,后续运行时,需修改串口名为实际串口名。
最后,添加UART读写权限,启动终端,输入:
sudo usermod -a -G dialout $USER
重启计算机,或注销账户重新登陆(可能不行),即可获取读写权限。
新开终端,输入
cd catkin_ws
source devel/setup.bash
roslaunch dji_sdk sdk.launch
若出现错误,依次检查串口名,TX和RX是否反接,USB-TTL模块是否松动等,还是不行就重启试试,出现successful即成功,连接Dji Assistant 2,遥控器开启并切换F模式,可运行仿真例程,新启终端,输入:
source devel/setup.bash
rosrun dji_sdk_demo demo_flight_control
其他例程也可以试一试。
MATLAB r2020b 以上版本安装ROS Toolbox
matlab r2020a 以下版本除安装ROS Toolbox外,还需安装ROS Toolbox interface for ROS Custom Messages
无论哪种版本,安装完成后在matlab命令行里输入
folderpath=fullfile('/home/用户名/catkin_ws/src')
rosgenmsg(folderpath)
按照提示继续操作,
完成。
在局域网内其他计算机使用MATLAB与ROS通信,
Since R2022a, the ROS Toolbox supports the ROS Noetic Ninjemys distribution for ROS.
- Windows® 10 only
- Linux® — Ubuntu 20.04 recommended
- macOS
For more information about ROS Noetic support, see their Target Platforms page.
When generating custom messages for ROS, or deploying ROS nodes from MATLAB® or Simulink®, you must build the necessary ROS packages. This requires you to have Python®, CMake, and a C++ compiler for your platform.
Python Version 3.9
-
To connect to ROS networks with the
rosinit
function, you must install and set up Python 3.9. -
To check your Python version, use the
pyenv
function.pyenv
ans = PythonEnvironment with properties: Version: "3.9" Executable: "C:\Python39\python.exe" Library: "C:\Python39\python39.dll" Home: "C:\Python39" Status: NotLoaded ExecutionMode: InProcess
-
If your Python interpreter is set to a different version, restart MATLAB and set the version with
pyenv
.pyenv('Version','3.9')
CMake
- Download and install CMake 3.16.3+.
C++ Compilers
- Windows — Visual Studio 2019
- Linux — GNU Compiler Collection (GCC) 6.3+
- macOS — Xcode 10+
From R2020b to R2021b, the ROS Toolbox supports the ROS Melodic Morenia distribution for ROS.
- Windows — Windows 10 recommended for all ROS distributions. For ROS Melodic, only Windows 10 is supported.
- Linux — Ubuntu 18.04 recommended.
- Mac OS X
For more information about ROS Melodic support, see their Target Platforms page.
When generating custom messages for ROS, or deploying ROS nodes from MATLAB or Simulink, you must build the necessary ROS packages. This requires you to have Python, CMake, and a C++ compiler for your platform:
Python Version 2.7
-
To connect to ROS networks with the
rosinit
function, you must install and set up Python 2.7. -
To check your Python version, use the
pyenv
function.pyenv
ans = PythonEnvironment with properties: Version: "2.7" Executable: "C:\Python27\pythonw.exe" Library: "C:\windows\system32\python27.dll" Home: "C:\Python27" Status: NotLoaded ExecutionMode: OutOfProcess
-
If your Python interpreter is set to a different version, restart MATLAB and set the version with
pyenv
.pyenv('Version','2.7')
CMake
- Download and install CMake 3.15.5+.
C++ Compilers
- Windows — Visual Studio 2017 or 2019
- Linux — GNU Compiler Collection (GCC) 6.3+
- macOS — Xcode 10+