Overview
--------
This branch (indigo-devel) is intended for ROS Indigo and above, and uses the Catkin buildsystem. It may also be compatible with ROS Hydro.
This ROS stack includes an Arduino library (called ROSArduinoBridge) and a collection of ROS packages for controlling an Arduino-based robot using standard ROS messages and services. The stack does **not** depend on ROS Serial.
Features of the stack include:
* Direct support for Ping sonar and Sharp infrared (GP2D12) sensors
* Can also read data from generic analog and digital sensors
* Can control digital outputs (e.g. turn a switch or LED on and off)
* Support for PWM servos
* Configurable base controller if using the required hardware
The stack includes a base controller for a differential drive
robot that accepts ROS Twist messages and publishes odometry data back to
the PC. The base controller requires the use of a motor controller and encoders for reading odometry data. The current version of the stack provides support for the following base controller hardware:
* Pololu VNH5019 dual motor controller shield (http://www.pololu.com/catalog/product/2502) or Pololu MC33926 dual motor shield (http://www.pololu.com/catalog/product/2503).
* Robogaia Mega Encoder shield
(http://www.robogaia.com/two-axis-encoder-counter-mega-shield-version-2.html) or on-board wheel encoder counters.
**NOTE:** The Robogaia Mega Encoder shield can only be used with an Arduino Mega. The on-board wheel encoder counters are currently only supported by Arduino Uno.
* L298 motor driver
* The library can be easily extended to include support for other motor controllers and encoder hardware or libraries.
Official ROS Documentation
--------------------------
A standard ROS-style version of this documentation can be found on the ROS wiki at:
http://www.ros.org/wiki/ros_arduino_bridge
System Requirements
-------------------
**Python Serial:** To install the python-serial package under Ubuntu, use the command:
$ sudo apt-get install python-serial
On non-Ubuntu systems, use either:
$ sudo pip install --upgrade pyserial
or
$ sudo easy_install -U pyserial
**Arduino IDE 1.6.6 or Higher:**
Note that the preprocessing of conditional #include statements is broken in earlier versions of the Arduino IDE. To ensure that the ROS Arduino Bridge firmware compiles correctly, be sure to install version 1.6.6 or higher of the Arduino IDE. You can download the IDE from https://www.arduino.cc/en/Main/Software.
**Hardware:**
The firmware should work with any Arduino-compatible controller for reading sensors and controlling PWM servos. However, to use the base controller, you will need a supported motor controller and encoder hardware as described above. If you do not have this hardware, you can still try the package for reading sensors and controlling servos. See the NOTES section at the end of this document for instructions on how to do this.
To use the base controller you must also install the appropriate libraries for your motor controller and encoders. For the Pololu VNH5019 Dual Motor Shield, the library can be found at:
https://github.com/pololu/Dual-VNH5019-Motor-Shield
For the Pololu MC33926 Dual Motor Shield, the library can be found at:
https://github.com/pololu/dual-mc33926-motor-shield
The Robogaia Mega Encoder library can be found at:
http://www.robogaia.com/uploads/6/8/0/9/6809982/__megaencodercounter-1.3.tar.gz
L298 Motor Driver doesn't require any libraries
These libraries should be installed in your standard Arduino
sketchbook/libraries directory.
Finally, it is assumed you are using version 1.0 or greater of the
Arduino IDE.
Preparing your Serial Port under Linux
--------------------------------------
Your Arduino will likely connect to your Linux computer as port /dev/ttyACM# or /dev/ttyUSB# where # is a number like 0, 1, 2, etc., depending on how many other devices are connected. The easiest way to make the determination is to unplug all other USB devices, plug in your Arduino, then run the command:
$ ls /dev/ttyACM*
or
$ ls /dev/ttyUSB*
Hopefully, one of these two commands will return the result you're looking for (e.g. /dev/ttyACM0) and the other will return the error "No such file or directory".
Next you need to make sure you have read/write access to the port. Assuming your Arduino is connected on /dev/ttyACM0, run the command:
$ ls -l /dev/ttyACM0
and you should see an output similar to the following:
crw-rw---- 1 root dialout 166, 0 2013-02-24 08:31 /dev/ttyACM0
Note that only root and the "dialout" group have read/write access. Therefore, you need to be a member of the dialout group. You only have to do this once and it should then work for all USB devices you plug in later on.
To add yourself to the dialout group, run the command:
$ sudo usermod -a -G dialout your_user_name
where your\_user\_name is your Linux login name. You will likely have to log out of your X-window session then log in again, or simply reboot your machine if you want to be sure.
When you log back in again, try the command:
$ groups
and you should see a list of groups you belong to including dialout.
Installation of the ros\_arduino\_bridge Stack
----------------------------------------------
$ cd ~/catkin_workspace/src
$ git clone https://github.com/hbrobotics/ros_arduino_bridge.git
$ cd ~/catkin_workspace
$ catkin_make
The provided Arduino library is called ROSArduinoBridge and is
located in the ros\_arduino\_firmware package. This sketch is
specific to the hardware requirements above but it can also be used
with other Arduino-type boards (e.g. Uno) by turning off the base
controller as described in the NOTES section at the end of this
document.
To install the ROSArduinoBridge library, follow these steps:
$ cd SKETCHBOOK_PATH
where SKETCHBOOK_PATH is the path to your Arduino sketchbook directory.
$ cp -rp `rospack find ros_arduino_firmware`/src/libraries/ROSArduinoBridge ROSArduinoBridge
This last command copies the ROSArduinoBridge sketch files into your sketchbook folder. The next section describes how to configure, compile and upload this sketch.
Loading the ROSArduinoBridge Sketch
-----------------------------------
* If you are using the base controller, make sure you have already installed the appropriate motor controller and encoder libraries into your Arduino sketchbook/librariesfolder.
* Launch the Arduino 1.0 IDE and load the ROSArduinoBridge sketch.
You should be able to find it by going to:
File->Sketchbook->ROSArduinoBridge
NOTE: If you don't have the required base controller hardware but
still want to try the code, see the notes at the end of the file.
Choose one of the supported motor controllers by uncommenting its #define statement and commenting out any others. By default, the Pololu VNH5019 driver is chosen.
Choose a supported encoder library by by uncommenting its #define statement and commenting out any others. the Robogaia Mega Encoder shield is chosen by default.
If you want to control PWM servos attached to your controller, look for the line:
<pre>
#define USE_SERVOS
</pre>
and make sure it is not commented out like this:
<pre>
//#define USE_SERVOS
</pre>
You must then edit the include file servos.h and change the N_SERVOS
parameter as well as the pin numbers for the servos you have attached.
* Compile and upload the sketch to your Arduino.
Firmware Commands
-----------------
The ROSArduinoLibrary accepts single-letter commands over the serial port for polling sensors, controlling servos, driving the robot, and reading encoders. These commands can be sent to the Arduino over any serial interface, including the Serial Monitor in the Arduino IDE.
**NOTE:** Before trying these commands, set the Serial Monitor baudrate to 57600 and the line terminator to "Carriage return" or "Both NL & CR" using the two pulldown menus on the lower right of the Serial Monitor window.
The
没有合适的资源?快使用搜索试试~ 我知道了~
ros-arduino-bridge
共74个文件
sample:11个
h:10个
py:7个
5星 · 超过95%的资源 需积分: 49 23 下载量 177 浏览量
2022-03-31
15:13:45
上传
评论 11
收藏 381KB RAR 举报
温馨提示
ros_arduino_bridge 树莓派和arduino联调通过USB线通信、控制,在noetic版本下,默认使用的是python3,需要修改很多细节,使用这个压缩包可以直接使用
资源详情
资源评论
资源推荐
收起资源包目录
ros_arduino_bridge.rar (74个子文件)
ros_arduino_bridge
ros_arduino_python
config
arduino_params.yaml 1KB
my_arduino_params.yaml 1KB
launch
arduino.launch 217B
src
ros_arduino_python
__pycache__
base_controller.cpython-37.pyc 6KB
arduino_driver.cpython-37.pyc 10KB
arduino_sensors.cpython-37.pyc 10KB
base_controller.py 9KB
arduino_driverYUANSHI.py 13KB
arduino_sensors.py 8KB
arduino_driver.py 12KB
__init__.py 0B
nodes
arduino_node.py 9KB
setup.py 232B
CMakeLists.txt 376B
package.xml 670B
ros_arduino_msgs
msg
SensorState.msg 45B
Analog.msg 66B
AnalogFloat.msg 72B
Digital.msg 54B
ArduinoConstants.msg 80B
srv
DigitalWrite.srv 25B
ServoRead.srv 27B
ServoWrite.srv 27B
DigitalRead.srv 25B
DigitalSetDirection.srv 29B
AnalogWrite.srv 27B
AnalogRead.srv 27B
CMakeLists.txt 743B
package.xml 541B
.git
index 6KB
hooks
fsmonitor-watchman.sample 3KB
pre-push.sample 1KB
prepare-commit-msg.sample 1KB
applypatch-msg.sample 478B
pre-commit.sample 2KB
pre-receive.sample 544B
pre-applypatch.sample 424B
commit-msg.sample 896B
pre-rebase.sample 5KB
update.sample 4KB
post-update.sample 189B
config 289B
description 73B
refs
tags
heads
indigo-devel 41B
remotes
origin
HEAD 38B
branches
logs
refs
heads
indigo-devel 191B
remotes
origin
HEAD 191B
HEAD 191B
packed-refs 681B
objects
info
pack
pack-4058181e91547e68334f6b1e9a30b654cf6e1c31.idx 38KB
pack-4058181e91547e68334f6b1e9a30b654cf6e1c31.pack 293KB
info
exclude 240B
HEAD 29B
ros_arduino_bridge
CMakeLists.txt 117B
package.xml 567B
.gitignore 1KB
ros_arduino_firmware
src
libraries
MegaRobogaiaPololu
diff_controller.h 2KB
servos.h 196B
MegaRobogaiaPololu.ino 9KB
sensors.h 1001B
commands.h 496B
ROSArduinoBridge
ROSArduinoBridge.ino 9KB
motor_driver.ino 3KB
motor_driver.h 531B
diff_controller.h 4KB
encoder_driver.ino 2KB
servos.h 997B
encoder_driver.h 630B
sensors.h 1001B
servos.ino 2KB
commands.h 542B
CMakeLists.txt 198B
package.xml 375B
README.md 20KB
共 74 条
- 1
许先A
- 粉丝: 6
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论5