Ask Your Question
0

Trouble following Lego NXT tutorials

asked 2011-03-22 00:57:49 -0500

im gravatar image

updated 2014-01-28 17:09:23 -0500

ngrennan gravatar image

I've been trying to get ROS-NXT to work with my Lego NXT. In the past, I've successfuly been able to write programs in NXT-Python in order to control the robot. However, this is my first experience with ROS.

I've read the docs for ROS, and tried to follow to the tutorials for ROS-NXT. I can reproducibly get the touch sensor demo to work. However, I just cannot get the teleop demo working. Do you know if this example is in working condition? Any ideas what is going on? I know that my keystrokes are being recieved by the program (I modified the code to double check the keystrokes were being received). I also tried removing the gyroscope sensor from robot.yaml before I launch nxt_robot_sensor_car (since I don't have one).

I'm on Ubuntu 10.10. My NXT has the correct firmware (1.28). As I said, I can get the robot to move around using NXT-Python but have had no luck with ROS-NXT so far.

Any help you can provide would be much appreciated!

Sample errors I see from the terminal where I launched nxt_robot_sensor_car:

[WARN] [WallTime: 1300631066.685828] l_wheel_joint not reaching
desired frequency: actual 1.132604, desired 20.000000
[WARN] [WallTime: 1300631066.686174] m_wheel_joint not reaching
desired frequency: actual 0.575387, desired 1.000000
[WARN] [WallTime: 1300631066.686410] ultrasonic_sensor not reaching
desired frequency: actual 0.982331, desired 5.000000
[WARN] [WallTime: 1300631066.686641] color_sensor not reaching desired
frequency: actual 1.077575, desired 10.000000
[WARN] [WallTime: 1300631066.697589] r_wheel_joint not reaching
desired frequency: actual 8.055285, desired 20.000000
[WARN] [WallTime: 1300631066.803811] l_wheel_joint not reaching
desired frequency: actual 1.117669, desired 20.000000
[WARN] [WallTime: 1300631066.804158] m_wheel_joint not reaching
desired frequency: actual 0.571507, desired 1.000000
[WARN] [WallTime: 1300631066.804392] ultrasonic_sensor not reaching
desired frequency: actual 0.971076, desired 5.000000
[WARN] [WallTime: 1300631066.804623] color_sensor not reaching desired
frequency: actual 1.064048, desired 10.000000
[WARN] [WallTime: 1300631066.819145] r_wheel_joint not reaching
desired frequency: actual 8.072015, desired 20.000000
[ERROR] [WallTime: 1300631066.895515] bad callback: <bound method
BaseController.jnt_state_cb of <__main__.BaseController instance at
0x9a0e4ac>>
Traceback (most recent call last):
 File "/opt/ros/diamondback/stacks/ros_comm/clients/rospy/src/rospy/topics.py",
line 563, in _invoke_callback
   cb(msg)
 File "/opt/ros/diamondback/stacks/nxt/nxt_controllers/scripts/base_controller.py",
line 78, in jnt_state_cb
   self.vel_trans = 0.5*self.vel_trans + 0.5*(velocity[self.r_joint]
+ velocity[self.l_joint])*self.wheel_radius/2.0
KeyError: 'l_wheel_joint'

[ERROR] [WallTime: 1300631066.896057] bad callback: <bound method
BaseOdometry.jnt_state_cb of <__main__.BaseOdometry instance at
0x91efa2c>>
Traceback (most recent call last):
 File "/opt/ros/diamondback/stacks/ros_comm/clients/rospy/src/rospy/topics.py",
line 563, in _invoke_callback
   cb(msg)
 File "/opt/ros/diamondback/stacks/nxt/nxt_controllers/scripts/base_odometry.py",
line 80, in jnt_state_cb
   self.l_pos = position[self.l_joint]
KeyError: 'l_wheel_joint'
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2011-03-22 09:51:13 -0500

im gravatar image

I managed to get the teleop demo to work by reducing the frequency of the left and right motors (in the robot.yaml file within the nxt_robot_sensor_car package). I changed them from 20.0 to 6.0. This could be because I was using Ubuntu within VMWare Player. I still find this surprising because I am running this on a beefy machine (Win7 Ultimate, Intel Quad Core, 3GB of RAM).

Recapping what I did so others can follow. In order to get the nxt_teleop demo to work, I had to invoke at least 3 processes:

In Terminal 1:

roscore

In Terminal 2:

roscd nxt_robot_sensor_car

roslaunch nxt_robot_sensor_car robot.launch

In Terminal 3:

roscd nxt_teleop

roslaunch teleop_keyboard.launch

edit flag offensive delete link more

Comments

yeah it looks like your process is getting starved.. If you change the launch file to lower the update rate for the color sensor that might help. Are you running over bluetooth? the bluetooth has know bandwith issues.
mmwise gravatar image mmwise  ( 2011-03-24 16:35:15 -0500 )edit
0

answered 2011-05-30 01:51:02 -0500

Skinkworks gravatar image

updated 2011-05-30 01:53:24 -0500

The frequency issues are not a function of your computer; there are a function of the bluetooth link to the NXT. If you use a USB connection, you can double or triple the frequencies of what you use with Bluetooth. The frequencies you used in your solution are about the maximum I can use with bluetooth. Also, any other bluetooth devices you are using slow down the connection to the NXT; for example, it is impossible to use the Wiimote and NXT at the same time, with the same bluetooth adapter.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-03-22 00:57:49 -0500

Seen: 978 times

Last updated: May 30 '11