JetBot项目原生环境配置指南(非Docker方案)

JetBot项目原生环境配置指南(非Docker方案)

jetbot An educational AI robot based on NVIDIA Jetson Nano. jetbot 项目地址: https://gitcode.com/gh_mirrors/je/jetbot

前言

JetBot作为基于NVIDIA Jetson平台的开源智能小车项目,为AI教育和开发提供了绝佳的平台。本文将详细介绍如何在Jetson设备上配置原生运行环境(非Docker方案),适合希望直接与硬件交互、进行深度定制的开发者。

环境准备

1. 基础系统安装

首先需要确保设备已安装NVIDIA JetPack SDK,这是Jetson平台的完整开发套件,包含:

  • Ubuntu操作系统
  • CUDA加速库
  • cuDNN深度学习库
  • TensorRT推理优化器

建议使用最新版本的JetPack以获得最佳性能支持。

2. 关键依赖安装

PyTorch框架

PyTorch是JetBot项目的主要AI框架,需要安装适配Jetson平台的版本。由于ARM架构的特殊性,不能直接使用pip安装,必须使用NVIDIA官方提供的预编译包。

Node.js环境

Jupyter Lab依赖Node.js运行前端组件,推荐安装LTS版本:

curl -sL https://deb.nodesource.com/setup_10.x | bash -
sudo apt-get install -y nodejs libffi-dev

Jupyter Lab配置

1. 核心组件安装

sudo python3 -m pip install jupyter jupyterlab
jupyter labextension install @jupyter-widgets/jupyterlab-manager

2. 图像交互组件

为支持道路跟随等示例中的图像点击功能,需要额外安装:

sudo apt-get install -y libssl1.0-dev
git clone https://github.com/jaybdub/jupyter_clickable_image_widget
cd jupyter_clickable_image_widget
git checkout tags/v0.1
sudo pip3 install -e .
jupyter labextension install js
jupyter lab build
cd ..

3. 其他依赖项

sudo apt-get update && apt-get install -y process-manager unzip
sudo apt install -y python3-smbus && pip3 install pyzmq

性能优化组件

torch2trt安装(可选)

这个工具可以将PyTorch模型转换为TensorRT格式,显著提升推理速度:

git clone https://github.com/NVIDIA-AI-IOT/torch2trt
cd torch2trt
python3 setup.py install
cd ..

JetBot核心包安装

git clone https://github.com/NVIDIA-AI-IOT/jetbot
cd jetbot
sudo python3 setup.py install

如果计划修改JetBot源代码,建议使用开发模式安装:

sudo python3 setup.py develop

系统服务配置

1. Jupyter Lab密码设置

jupyter notebook password

2. 创建开机自启服务

创建jetbot_jupyter.service文件:

[Unit]
Description=Jupyter Notebook 

[Service]
Type=simple
User=jetson
ExecStart=/bin/sh -c "jupyter lab --ip=0.0.0.0 --no-browser --allow-root"
WorkingDirectory=/home/jetson
Restart=Always

[Install]
WantedBy=multi-user.target

部署服务:

sudo cp jetbot_jupyter.service /etc/systemd/system/
sudo systemctl enable jetbot_jupyter

3. IP显示服务

创建jetbot_display.service文件:

[Unit]
Description=IP Display Service

[Service]
Type=simple
User=jetson
ExecStart=/bin/sh -c "python3 -m jetbot.apps.stats"
WorkingDirectory=/home/jetson
Restart=Always

[Install]
WantedBy=multi-user.target

部署服务:

sudo cp jetbot_display.service /etc/systemd/system/
sudo systemctl enable jetbot_display

验证与使用

完成上述配置后,重启设备即可:

  1. OLED屏将显示设备IP地址
  2. Jupyter Lab服务会自动启动
  3. 通过浏览器访问https://<设备IP>:8888即可开始编程

常见问题

  1. 密码设置不生效:检查~/.jupyter/jupyter_notebook_config.json文件是否生成
  2. 服务启动失败:使用journalctl -u jetbot_jupyter -b查看日志
  3. 显示服务异常:确认已正确连接OLED屏并安装I2C驱动

结语

原生环境配置虽然步骤较多,但提供了更直接的硬件访问能力和更高的定制自由度。适合需要进行深度开发的用户。配置完成后,您就可以开始探索JetBot的各种AI功能了,包括物体识别、自主导航等有趣的应用。

jetbot An educational AI robot based on NVIDIA Jetson Nano. jetbot 项目地址: https://gitcode.com/gh_mirrors/je/jetbot

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

邬情然Harley

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值