0
$\begingroup$

Rosanswers logo

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'

Originally posted by im on ROS Answers with karma: 26 on 2011-03-22

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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


Originally posted by im with karma: 26 on 2011-03-22

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by mmwise on 2011-03-24:
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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.