Skip to content

Commit c33e72a

Browse files
Add readme
1 parent cfdb6d2 commit c33e72a

1 file changed

Lines changed: 40 additions & 217 deletions

File tree

README.md

Lines changed: 40 additions & 217 deletions
Original file line numberDiff line numberDiff line change
@@ -1,238 +1,61 @@
1-
NXT-ROS
2-
=======
31

4-
A software stack containing tools for using LEGO Mindstorms NXT with ROS.
2+
<h1 align="center">
3+
<br>
4+
<img src ="https://avatars0.githubusercontent.com/u/32429642?v=4&s=100" />
5+
<br>
6+
NXT ROS - Core
7+
<br>
8+
</h1>
59

6-
This branch depends on:<br> &#8226; ROS Groovy<br> &#8226; Python 2.x<br> &#8226; NXT-Python v2.2.2
10+
Software stack containing all the required pieces to use Lego Mindstorms NXT with ROS
711

8-
Originally forked from: http://stack-nxt.foote-ros-pkg.googlecode.com/hg
12+
## Installation
913

10-
.
14+
### ROS package
1115

12-
###Documentation
13-
Installation instructions are in this README file.
16+
The repository is expected to be used as the source folder of a working catkin environnement.
1417

15-
The original documentation has more detailed information:
16-
[wiki.ros.org/nxt](http://wiki.ros.org/nxt)
17-
[wiki.ros.org/nxt_robots](http://wiki.ros.org/nxt_robots)
18-
[wiki.ros.org/nxt_apps](http://wiki.ros.org/nxt_apps)
19-
.
20-
21-
###Package status
22-
23-
These packages use `rosbuild` and were tested
24-
with ROS Groovy on Ubuntu 12.04.
25-
26-
The following features have been tested:
27-
28-
**nxt** stack:
29-
30-
- **nxt_controllers**
31-
Compiles ok, the base_controller has been tested.
32-
33-
- **nxt_description**
34-
Working.
35-
36-
- **nxt_lxf2urdf**
37-
Compiles ok, un-tested.
38-
39-
- **nxt_msgs**
40-
Working.
41-
42-
- **nxt_python**
43-
Working.
44-
45-
- **nxt_ros**
46-
Working.
47-
There is a new option to read the position of a motor as the absolute angle from 0 to 2*pi radians. By default the motor position is measured as the total +/- rotation in either direction, relative to the starting position.
48-
49-
- **nxt_ros_test**
50-
Working.
51-
52-
- **nxt_rviz_plugin**
53-
Working.
54-
55-
**nxt_robots** stack:
56-
57-
- **nxt_robot_gyro_car**
58-
Working. The robot model can be viewed in Rviz.
59-
60-
- **nxt_robot_kit_test**
61-
Working. This is a test package, so the robot looks like a pile of disconnected LEGO parts when viewed in Rviz.
62-
63-
- **nxt_robot_sensor_car**
64-
Working. The robot model can be viewed in Rviz.
65-
66-
**nxt_apps** stack:
67-
68-
- **nxt_assisted_teleop**
69-
Working.
70-
71-
- **nxt_teleop**
72-
Working.
73-
74-
.
75-
76-
77-
###Installation
78-
79-
Upgrade the firmware on your NXT brick.
80-
The minimum required version is 1.28, but 1.31 is the latest as of Jan 2016.
81-
82-
Clone the Groovy branch of this repository:
83-
> $ cd ~/
84-
> $ git clone https://github.com/dbworth/NXT-ROS.git --branch groovy
85-
86-
Copy the 3 stacks into your ROS Workspace.
87-
Note: you only need the `nxt` stack to get started.
88-
> $ cp NXT-ROS/nxt ~/ROS_WORKSPACE/
89-
> $ cp NXT-ROS/nxt_robots ~/ROS_WORKSPACE/
90-
> $ cp NXT-ROS/nxt_apps ~/ROS_WORKSPACE/
91-
92-
Add the stacks to your $ROS_PACKAGE_PATH.
93-
You might like to add these commands to your `~/.bashrc` file.
94-
> $ export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/ros_workspace/nxt
95-
> $ export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/ros_workspace/nxt_robots
96-
> $ export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/ros_workspace/nxt_apps
97-
98-
**Install dependencies:**
99-
100-
NXT-Python v2.2.2 is automatically installed in the `/src` directory of the `nxt_python` package when we run `rosmake`.
101-
102-
You can install the other dependencies using the Ubuntu Package Manager or ROSdep:
103-
> $ sudo apt-get install ros-groovy-ros-comm ros-groovy-common-msgs ros-groovy-joystick-drivers ros-groovy-visualization ros-groovy-navigation ros-groovy-orocos-kinematics-dynamics
104-
> $ sudo aptitude install libusb-dev python-usb python-bluez
105-
106-
or
107-
108-
> $ sudo rosdep install -y nxt
109-
> $ sudo rosdep install -y nxt_robots
110-
> $ sudo rosdep install -y nxt_apps
111-
112-
Compile the stacks of packages:
113-
> $ rosmake nxt
114-
> $ rosmake nxt_robots
115-
> $ rosmake nxt_apps
116-
117-
**Set the USB permissions:**
118-
119-
Add a new group:
120-
> $ sudo groupadd lego
121-
122-
Add yourself to that group:
123-
> $ sudo usermod -a -G lego USERNAME
124-
125-
For Ubuntu versions before 12.0, create a udev rules file for the lego group that you just created:
126-
> $ echo "BUS==\"usb\", ATTRS{idVendor}==\"0694\", GROUP=\"lego\", MODE=\"0660\"" > /tmp/70-lego.rules && sudo mv /tmp/70-lego.rules /etc/udev/rules.d/70-lego.rules
127-
128-
For Ubuntu 12.04 use:
129-
> $ echo "SUBSYSTEM==\"usb\", ATTRS{idVendor}==\"0694\", GROUP=\"lego\", MODE=\"0660\"" > /tmp/70-lego.rules && sudo mv /tmp/70-lego.rules /etc/udev/rules.d/70-lego.rules
130-
131-
Restart udev:
132-
> $ sudo restart udev
133-
134-
Log-out or restart your computer.
135-
136-
137-
###Test the installation:
138-
139-
Connect your NXT Brick to the computer via USB cable.
140-
You can run this utility to display information about your Brick:
141-
> $ rosrun nxt_python nxt_test
142-
143-
You should see the following output:
14418
```
145-
NXT brick name: MyBrick
146-
Host address: 00:16:00:00:D3:00
147-
Bluetooth signal strength: 0
148-
Free user flash: 25872
149-
Protocol version 1.124
150-
Firmware version 1.31
151-
Battery level 7602 mV
19+
mkdir nxt
20+
cd nxt
21+
git clone --recursive https://github.com/NXT-ROS/nxt.git src
22+
catkin init
23+
catkin build
15224
```
15325

154-
**nxt** stack:
155-
156-
Connect a touch sensor to port 1.
157-
> $ roscore
158-
> $ rosrun nxt_python touch_sensor_test.py
159-
160-
When you push the touch sensor, the output on the screen will change.
161-
The node automatically exits are 5 seconds.
162-
163-
Now connect a motor to port A.
164-
> $ roslaunch nxt_ros_test test.launch
165-
166-
Check the status of the touch sensor using ROS:
167-
> $ rostopic echo /my_touch_sensor
168-
169-
When you push the touch sensor, the boolean value published in the ROS msg will change.
170-
171-
Read the position of the motor using ROS:
172-
> $ rostopic echo /joint_states
173-
174-
When you rotate the motor shaft by hand, the position and velocity values published in the ROS msg will change.
175-
176-
Make the motor rotate using ROS:
177-
> $ rostopic pub /joint_command nxt_msgs/JointCommand '{name: 'motor_joint', effort: 0.8}' --once
178-
179-
The 'effort' value can be in the range 0.0 to 1.25, with +/- to specify the direction.
180-
181-
To stop the motor, set the effort to 0.0:
182-
> $ rostopic pub /joint_command nxt_msgs/JointCommand '{name: 'motor_joint', effort: 0.0}' --once
183-
184-
**nxt_robots** stack:
26+
You now have all the required packages to run the ros-nxt core.
18527

186-
Connect motors to Port A and Port B of the NXT Brick.
187-
Connect an ultrasonic sensor to Port 2.
188-
Connect the NXT to your computer.
28+
### NXT USB
18929

190-
> $ roscore
30+
In order to communicate with the NXT, you will need to set the correct permissions.
19131

192-
In a new terminal:
193-
> $ roslaunch nxt_robot_gyro_car robot.launch
194-
195-
In a new terminal:
196-
> $ rosrun rviz rviz
197-
198-
In Rviz you'll need to set the Fixed Frame to '/base_link'.
199-
Add a RobotModel display so you can visualize the robot.
200-
201-
**nxt_apps** stack:
202-
203-
In a new terminal:
204-
> $ roslaunch nxt_teleop teleop_keyboard.launch
205-
206-
Use the arrow keys to control the motors.
207-
208-
You can also use a joystick.
209-
Configure the joystick using the instructions here:
210-
http://wiki.ros.org/joy/Tutorials/ConfiguringALinuxJoystick
211-
212-
> $ roslaunch nxt_teleop teleop_joy.launch
213-
214-
With the Microsoft XBox 360 joystick, you need to hold down the top-left button. The left joystick controls turning, the right joystick goes forward.
215-
216-
**MotorControl** firmware:
217-
218-
[MotorControl](http://www.mindstorms.rwth-aachen.de/trac/wiki/MotorControl) is a program that can be optionally installed on your NXT Brick to provide more accurate control of the motors using python. Instead of sending commands directly to the motor, you send commands to the onboard controller which tracks the status of the motors.
219-
220-
Copy the MotorControl program to your NXT Brick.
221-
You must first change to the directory containing the *.rxe file:
222-
> $ roscd nxt_python/src/MotorControl/
223-
224-
Connect to your Brick via USB cable and transfer the program binary:
32+
```
33+
sudo groupadd lego
34+
sudo usermod -a -G lego $(id -un)
35+
echo "SUBSYSTEM=="usb", ATTRS{idVendor}=="0694", GROUP="lego", MODE="0660"" > /tmp/70-lego.rules && sudo mv /tmp/70-lego.rules /etc/udev/rules.d/70-lego.rules
36+
```
22537

226-
> $ rosrun nxt_python nxt_push MotorControl22.rxe
38+
You can now reboot your system and hook up your NXT.
22739

228-
Test the controller using the provided test script:
229-
> $ roscore
230-
> $ rosrun nxt_python motor_cont_test.py
40+
## Dependencies
23141

42+
The nxt-ros packages depends on:
23243

233-
=============
44+
* ROS Kinetic
45+
* Python 3
46+
* NXT Python v3 (shipped as submodule)
23447

48+
## Using NXT ROS
23549

50+
As for any catkin package, you first need to add its folders to your environnement (make sure to select the correct file for your system).
23651

52+
```
53+
cd nxt
54+
source devel/setup.(bash|sh|zsh)
55+
```
23756

57+
You can then start ros core and use any componnents of the nxt stack:
23858

59+
```
60+
roscore
61+
```

0 commit comments

Comments
 (0)