tork-a / roomblock

48 stars 15 forks source link

Roomblock fail to open port /dev/roomba #14

Open rwayong opened 5 years ago

rwayong commented 5 years ago

Hi,

I installed roomblock according to the instructions (sudo apt-get install ...).

First I launched roscore, then on separate terminal, I launched roslaunch roomblock_bringup roomblock.launch. It gave me error that say it cannot bind to /dev/rplidar. So I remapped my rplidar serial port by executing "create_udev_rules.sh" located at "/catkin_ws/src/roomblock/roomblock_bringup/scripts". It worked for my rplidar as shown below.

pi@pi-desktop:~$ ls -l /dev | grep ttyUSB
lrwxrwxrwx  1 root root           7 11月 26 10:25 rplidar -> ttyUSB0
crwxrwxrwx  1 root dialout 188,   0 11月 26 10:29 ttyUSB0
crwxrwxrwx  1 root dialout 188,   1 11月 26 10:25 ttyUSB1

However, my roomba serial port (ttyUSB1) is not remapped. I checked my roomba vendor and product id,

pi@pi-desktop:~$ lsusb
Bus 001 Device 008: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 006: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light
Bus 001 Device 007: ID 05ac:021f Apple, Inc. Aluminum Mini Keyboard (JIS)
Bus 001 Device 005: ID 05ac:1005 Apple, Inc. 
Bus 001 Device 004: ID 05ac:0304 Apple, Inc. Mighty Mouse [Mitsumi, M1152]
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I found that my vendor and product id setting in roomba.rules didn't match, so I changed it to

KERNEL=="ttyUSB*", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", MODE:="0777", SYMLINK+="roomba"

Then, I executed "delete_udev_rules.sh" to reset my udev rules and once again I executed "create_udev_rules.sh". Nevertheless, when I launched > roslaunch roomblock_bringup roomblock.launch, it gave me error as below.

pi@pi-desktop:~$ roslaunch roomblock_bringup roomblock.launch 
... logging to /home/pi/.ros/log/c96152be-0feb-11ea-944c-b827eba5a161/roslaunch-pi-desktop-2111.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

xacro: Traditional processing is deprecated. Switch to --inorder processing!
To check for compatibility of your document, use option --check-order.
For more infos, see http://wiki.ros.org/xacro#Processing_Order
deprecated: xacro tags should be prepended with 'xacro' xml namespace.
Use the following script to fix incorrect usage:
        find . -iname "*.xacro" | xargs sed -i 's#<\([/]\?\)\(if\|unless\|include\|arg\|property\|macro\|insert_block\)#<\1xacro:\2#g'
when processing file: /opt/ros/kinetic/share/roomblock_description/robots/roomblock.urdf.xacro

xacro.py is deprecated; please use xacro instead
started roslaunch server http://pi-desktop:45632/

SUMMARY
========

PARAMETERS
 * /raspicam_node/camera_frame_id: raspicam
 * /raspicam_node/camera_info_url: package://raspica...
 * /raspicam_node/framerate: 30
 * /raspicam_node/hFlip: True
 * /raspicam_node/height: 960
 * /raspicam_node/vFlip: True
 * /raspicam_node/width: 1280
 * /robot_description: <?xml version="1....
 * /robot_pose_ekf/freq: 10.0
 * /robot_pose_ekf/imu_used: False
 * /robot_pose_ekf/odom_used: True
 * /robot_pose_ekf/output_frame: odom
 * /robot_pose_ekf/publish_tf: True
 * /robot_pose_ekf/sensor_timeout: 1.0
 * /robot_pose_ekf/vo_used: False
 * /robot_state_publisher/publish_frequency: 5.0
 * /rosdistro: kinetic
 * /rosversion: 1.12.14
 * /rplidarNode/angle_compensate: True
 * /rplidarNode/frame_id: laser
 * /rplidarNode/inverted: False
 * /rplidarNode/serial_baudrate: 115200
 * /rplidarNode/serial_port: /dev/rplidar
 * /turtlebot_node/bonus: False
 * /turtlebot_node/has_gyro: False
 * /turtlebot_node/operation_mode: 2
 * /turtlebot_node/port: /dev/roomba
 * /turtlebot_node/robot_type: roomba
 * /turtlebot_node/update_rate: 30.0

NODES
  /
    raspicam_node (raspicam_node/raspicam_node)
    robot_pose_ekf (robot_pose_ekf/robot_pose_ekf)
    robot_state_publisher (robot_state_publisher/robot_state_publisher)
    rplidarNode (rplidar_ros/rplidarNode)
    turtlebot_node (create_node/turtlebot_node.py)

ROS_MASTER_URI=http://localhost:11311

process[robot_state_publisher-1]: started with pid [2140]
process[rplidarNode-2]: started with pid [2143]
process[turtlebot_node-3]: started with pid [2145]
process[robot_pose_ekf-4]: started with pid [2158]
ERROR: cannot launch node of type [raspicam_node/raspicam_node]: raspicam_node
ROS path [0]=/opt/ros/kinetic/share/ros
ROS path [1]=/opt/ros/kinetic/share
[ERROR] [1574731763.728840]: Failed to open port /dev/roomba. Error:  Please make sure the Create cable is plugged into the computer. 

Failed to open port /dev/roomba. Error:  Please make sure the Create cable is plugged into the computer. 
Failed to open port /dev/roomba. Error:  Please make sure the Create cable is plugged into the computer. 

Can somebody help me with this problem? I'm still new to ROS, so maybe I'm looking at the wrong places and I really appreciate if someone can point out where the problem is.

Thanks!

gavanderhoorn commented 5 years ago

Initial post on ROS Answers: Roomblock fail to open port /dev/roomba due to failure in remapping roomba serial port.

7675t commented 5 years ago

Sorry to be late to respond. Right, the udev rules depends on the hardware, so if you are using different serial-USB adapter for Roomba, you have to change PID and UID (Yes, it may not be good design...).

Please make sure your /dev/roomba point to your serial-USB device for Roomba. If not, what happens if you do it manually like follows?

$ sudo chmod 777 /dev/ttyUSB1
$ ln -s /dev/ttyUSB1 /dev/roomba

In addition, please notice you have to restart udev daemon like

$ sudo service udev restart

and make sure you re-plug the USB device after change your udev rule files.

rwayong commented 4 years ago

Thanks for your reply. I tried to set the serial port manually and it worked. However, when I tried to move my roomba using my keyboard, it didn't move. In the terminal that launch roslaunch roomblock_bringup roomblock.launch, it gave me a warn "Failed to read sensor package. 5 retries left." as below.

pi@pi-desktop:~$` roslaunch roomblock_bringup roomblock.launch 
... logging to /home/pi/.ros/log/21e28686-1723-11ea-b5d8-b827eba5a161/roslaunch-pi-desktop-2720.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

xacro: Traditional processing is deprecated. Switch to --inorder processing!
To check for compatibility of your document, use option --check-order.
For more infos, see http://wiki.ros.org/xacro#Processing_Order
deprecated: xacro tags should be prepended with 'xacro' xml namespace.
Use the following script to fix incorrect usage:
    find . -iname "*.xacro" | xargs sed -i 's#<\([/]\?\)\  
(if\|unless\|include\|arg\|property\|macro\|insert_block\)#<\1xacro:\2#g'
when processing file: /opt/ros/kinetic/share/roomblock_description/robots/roomblock.urdf.xacro

xacro.py is deprecated; please use xacro instead
started roslaunch server http://pi-desktop:39906/

SUMMARY
========

PARAMETERS
 * /raspicam_node/camera_frame_id: raspicam
 * /raspicam_node/camera_info_url: package://raspica...
 * /raspicam_node/framerate: 30
 * /raspicam_node/hFlip: True
 * /raspicam_node/height: 960
 * /raspicam_node/vFlip: True
 * /raspicam_node/width: 1280
 * /robot_description: <?xml version="1....
 * /robot_pose_ekf/freq: 10.0
 * /robot_pose_ekf/imu_used: False
 * /robot_pose_ekf/odom_used: True
 * /robot_pose_ekf/output_frame: odom
 * /robot_pose_ekf/publish_tf: True
 * /robot_pose_ekf/sensor_timeout: 1.0
 * /robot_pose_ekf/vo_used: False
 * /robot_state_publisher/publish_frequency: 5.0
 * /rosdistro: kinetic
 * /rosversion: 1.12.14
 * /rplidarNode/angle_compensate: True
 * /rplidarNode/frame_id: laser
 * /rplidarNode/inverted: False
 * /rplidarNode/serial_baudrate: 115200
 * /rplidarNode/serial_port: /dev/rplidar
 * /turtlebot_node/bonus: False
 * /turtlebot_node/has_gyro: False
 * /turtlebot_node/operation_mode: 2
 * /turtlebot_node/port: /dev/roomba
 * /turtlebot_node/robot_type: roomba
 * /turtlebot_node/update_rate: 30.0

NODES
  /
    raspicam_node (raspicam_node/raspicam_node)
    robot_pose_ekf (robot_pose_ekf/robot_pose_ekf)
    robot_state_publisher (robot_state_publisher/robot_state_publisher)
    rplidarNode (rplidar_ros/rplidarNode)
    turtlebot_node (create_node/turtlebot_node.py)

ROS_MASTER_URI=http://localhost:11311

process[robot_state_publisher-1]: started with pid [2740]
process[rplidarNode-2]: started with pid [2741]
process[turtlebot_node-3]: started with pid [2742]
process[robot_pose_ekf-4]: started with pid [2754]
ERROR: cannot launch node of type [raspicam_node/raspicam_node]: raspicam_node
ROS path [0]=/opt/ros/kinetic/share/ros
ROS path [1]=/opt/ros/kinetic/share
[WARN] [1575525192.673396]: Failed to read sensor package. 5 retries left.
[WARN] [1575525197.529034]: Failed to read sensor package. 5 retries left.
[WARN] [1575525209.107746]: Failed to read sensor package. 5 retries left.
[WARN] [1575525212.151769]: Failed to read sensor package. 5 retries left.
[WARN] [1575525215.188088]: Failed to read sensor package. 5 retries left.

I really thankful if you can help me with this problem. Thanks!

7675t commented 4 years ago

Please confirm your Roomba is power on. You need to power on by pushing the power button.

rwayong commented 4 years ago

Please confirm your Roomba is power on. You need to power on by pushing the power button.

Yeah, I pushed the power button and the green light appeared. Then, when I roslaunch roomblock_bringup roomblock.launch and I heard "beep" sound from the roomba. Nevertheless, I still can't move my roomba by teleop keyboard.

The commands that I ran are as below.

roscore roslaunch roomblock_bringup roomblock.launch rosrun teleop_twist_keyboard teleop_twist_keyboard.py roslaunch roomblock_mapping gmapping.launch

And also, the rviz showed error on the laser scan as the attached picture. rviz_error

7675t commented 4 years ago

OK, don't jump on to SLAM, please check it step by step.

rwayong commented 4 years ago

I'm sorry for the late reply and happy new year bro :)

OK, don't jump on to SLAM, please check it step by step.

  • If you heard a short beep sound, I guess the communication with the Roomba should be OK.
  • To confirm this, check if create_node publishes the sensor topic on "mobile_base/sensors/core" by using rostopic echo
  • /joint_states should be published
  • /odom should be published too.

So after I run roscore and roslaunch roomblock_bringup roomblock.launch, I heard the short beep sound. First I ran rostopic list. The results is given below.

pi@pi-desktop:~$ rostopic list
/cmd_vel
/diagnostics
/joint_states
/mobile_base/sensors/core
/odom
/robot_pose_ekf/odom_combined
/rosout
/rosout_agg
/scan
/tf
/tf_static
/turtlebot_node/parameter_descriptions
/turtlebot_node/parameter_updates

Then I ran rostoic echo mobile_base/sensors/core and the results is shown below.

header: 
  seq: 18
  stamp: 
    secs: 1575526162
    nsecs: 283525943
  frame_id: ''
bumps_wheeldrops: 0
wall: False
cliff_left: False
cliff_front_left: False
cliff_front_right: False
cliff_right: False
virtual_wall: False
motor_overcurrents: 0
dirt_detector_left: 0
dirt_detector_right: 0
remote_opcode: 0
buttons: 0
distance: 0.0
angle: 0.0
charging_state: 0
voltage: 15301
current: -167
temperature: 19
charge: 1588
capacity: 2068
wall_signal: 0
cliff_left_signal: 2651
cliff_front_left_signal: 2691
cliff_front_right_signal: 2678
cliff_right_signal: 2644
user_digital_outputs: 0
user_digital_inputs: 0
user_analog_input: 0
charging_sources_available: 0
oi_mode: 3
song_number: 0
song_playing: False
number_of_stream_packets: 0
requested_velocity: 0
requested_radius: 0
requested_right_velocity: 0
requested_left_velocity: 0
  • Your rviz screen capture says some error on LaserScan. Can you show it?

I attached the screenshot that shows the error on LaserScan. In case you can't see it, I uploaded it to gdrive.

  • If above checks are all positive, check if the /cmd_vel is really working by publish the command as:
rostopic pub /cmd_vel geometry_msgs/Twist "linear:
  x: 0.1
  y: 0.0
  z: 0.0
angular:
  x: 0.0
  y: 0.0
  z: 0.0" 

Since /joint_states, /odom and mobile_base/sensors/core seems to be published, I ran the /cmd_vel. However, nothing happens and the clean button of the roomba starts blinking. I use Roomba 642 and the connector is a simple USB cable as shown below. image

I hoped you can help me with these problems. Thank you very much.

7675t commented 4 years ago

Very strange... It seems the ROS node is receiving data and sending commands successfully. To my knowledge, it should work correctly. Anything on /diagnostics ?

Can you check the sensors/core message when the cmd_vel is given?

requested_velocity: 0
requested_radius: 0

These value should be changed.

rwayong commented 4 years ago

After I published the cmd_vel, my /diagnostics looks like this.

pi@pi-desktop:~$ rostopic echo /diagnostics -n1
header: 
  seq: 1
  stamp: 
    secs: 1578886610
    nsecs: 336447000
  frame_id: ''
status: 
  - 
    level: 0
    name: "TurtleBot Node"
    message: "RUNNING"
    hardware_id: ''
    values: []
  - 
    level: 0
    name: "Operating Mode"
    message: "Full"
    hardware_id: ''
    values: []
  - 
    level: 0
    name: "Battery"
    message: "OK"
    hardware_id: ''
    values: 
      - 
        key: "Voltage (V)"
        value: "15.972"
      - 
        key: "Current (A)"
        value: "-0.159"
      - 
        key: "Temperature (C)"
        value: "20"
      - 
        key: "Charge (Ah)"
        value: "1.89"
      - 
        key: "Capacity (Ah)"
        value: "2.068"
  - 
    level: 0
    name: "Charging Sources"
    message: "None"
    hardware_id: ''
    values: []
  - 
    level: 0
    name: "Cliff Sensor"
    message: "OK"
    hardware_id: ''
    values: 
      - 
        key: "Left"
        value: "False"
      - 
        key: "Left Signal"
        value: "2655"
      - 
        key: "Front Left"
        value: "False"
      - 
        key: "Front Left Signal"
        value: "2678"
      - 
        key: "Front Right"
        value: "False"
      - 
        key: "Front Right Signal"
        value: "2646"
      - 
        key: "Right"
        value: "False"
      - 
        key: "Right Signal"
        value: "2670"
  - 
    level: 0
    name: "Wall Sensor"
    message: "OK"
    hardware_id: ''
    values: 
      - 
        key: "Wall"
        value: "False"
      - 
        key: "Wall Signal"
        value: "1"
      - 
        key: "Virtual Wall"
        value: "False"
  - 
    level: 1
    name: "Gyro Sensor"
    message: "Gyro Not Enabled: To enable the gyro set the has_gyro param in the turtlebot_node."
    hardware_id: ''
    values: []
  - 
    level: 0
    name: "Digital Outputs"
    message: "OK"
    hardware_id: ''
    values: 
      - 
        key: "Raw Byte"
        value: "1"
      - 
        key: "Digital Out 2"
        value: "ON"
      - 
        key: "Digital Out 1"
        value: "OFF"
      - 
        key: "Digital Out 0"
        value: "OFF"
---

And the value of requested_velocity and requested_radius remains 0. The detailed log is such as below.

pi@pi-desktop:~$ rostopic echo /mobile_base/sensors/core -n1
header: 
  seq: 7
  stamp: 
    secs: 1578886725
    nsecs:  99512100
  frame_id: ''
bumps_wheeldrops: 0
wall: False
cliff_left: False
cliff_front_left: False
cliff_front_right: False
cliff_right: False
virtual_wall: False
motor_overcurrents: 0
dirt_detector_left: 0
dirt_detector_right: 0
remote_opcode: 0
buttons: 0
distance: 0.00178223311997
angle: 0.0
charging_state: 0
voltage: 15972
current: -159
temperature: 19
charge: 1886
capacity: 2068
wall_signal: 1
cliff_left_signal: 2656
cliff_front_left_signal: 2679
cliff_front_right_signal: 2669
cliff_right_signal: 2647
user_digital_outputs: 1
user_digital_inputs: 0
user_analog_input: 0
charging_sources_available: 0
oi_mode: 3
song_number: 0
song_playing: False
number_of_stream_packets: 0
requested_velocity: 0
requested_radius: 0
requested_right_velocity: 0
requested_left_velocity: 0
---
7675t commented 4 years ago

I can't find any problem in your information so far... Can you do roslaunch with --screen option? It may print more information.

roslaunch roomblock_bringup roomblock.launch --screen
rwayong commented 4 years ago

So, after I ran roslaunch roomblock_bringup roomblock.launch --screen, and I got a warning regarding Join state as below.

pi@pi-desktop:~$ roslaunch roomblock_bringup roomblock.launch --screen
... logging to /home/pi/.ros/log/6cfdb714-368e-11ea-8cdd-e3e328c81ceb/roslaunch-pi-desktop-5141.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

xacro: Traditional processing is deprecated. Switch to --inorder processing!
To check for compatibility of your document, use option --check-order.
For more infos, see http://wiki.ros.org/xacro#Processing_Order
deprecated: xacro tags should be prepended with 'xacro' xml namespace.
Use the following script to fix incorrect usage:
        find . -iname "*.xacro" | xargs sed -i 's#<\([/]\?\)\(if\|unless\|include\|arg\|property\|macro\|insert_block\)#<\1xacro:\2#g'
when processing file: /opt/ros/kinetic/share/roomblock_description/robots/roomblock.urdf.xacro

xacro.py is deprecated; please use xacro instead
started roslaunch server http://pi-desktop:45366/

SUMMARY
========

PARAMETERS
 * /raspicam_node/camera_frame_id: raspicam
 * /raspicam_node/camera_info_url: package://raspica...
 * /raspicam_node/framerate: 30
 * /raspicam_node/hFlip: True
 * /raspicam_node/height: 960
 * /raspicam_node/vFlip: True
 * /raspicam_node/width: 1280
 * /robot_description: <?xml version="1....
 * /robot_pose_ekf/freq: 10.0
 * /robot_pose_ekf/imu_used: False
 * /robot_pose_ekf/odom_used: True
 * /robot_pose_ekf/output_frame: odom
 * /robot_pose_ekf/publish_tf: True
 * /robot_pose_ekf/sensor_timeout: 1.0
 * /robot_pose_ekf/vo_used: False
 * /robot_state_publisher/publish_frequency: 5.0
 * /rosdistro: kinetic
 * /rosversion: 1.12.14
 * /rplidarNode/angle_compensate: True
 * /rplidarNode/frame_id: laser
 * /rplidarNode/inverted: False
 * /rplidarNode/serial_baudrate: 115200
 * /rplidarNode/serial_port: /dev/rplidar
 * /turtlebot_node/bonus: False
 * /turtlebot_node/has_gyro: False
 * /turtlebot_node/operation_mode: 2
 * /turtlebot_node/port: /dev/roomba
 * /turtlebot_node/robot_type: roomba
 * /turtlebot_node/update_rate: 30.0

NODES
  /
    raspicam_node (raspicam_node/raspicam_node)
    robot_pose_ekf (robot_pose_ekf/robot_pose_ekf)
    robot_state_publisher (robot_state_publisher/robot_state_publisher)
    rplidarNode (rplidar_ros/rplidarNode)
    turtlebot_node (create_node/turtlebot_node.py)

ROS_MASTER_URI=http://localhost:11311

process[robot_state_publisher-1]: started with pid [5161]
process[rplidarNode-2]: started with pid [5162]
process[turtlebot_node-3]: started with pid [5163]
process[robot_pose_ekf-4]: started with pid [5169]
ERROR: cannot launch node of type [raspicam_node/raspicam_node]: raspicam_node
ROS path [0]=/opt/ros/kinetic/share/ros
ROS path [1]=/opt/ros/kinetic/share
[ INFO] [1578979607.421641570]: RPLIDAR running on ROS package rplidar_ros. SDK Version:1.7.0
[ INFO] [1578979607.596823449]: output frame: odom
[ INFO] [1578979607.597141473]: base frame: base_footprint
RPLIDAR S/N: 9FE19AF2C1EA98D4BEEB9CF010323517
[ INFO] [1578979607.932560553]: Firmware Ver: 1.25
[ INFO] [1578979607.932726180]: Hardware Rev: 5
[ INFO] [1578979607.935083338]: RPLidar health status : 0
[ INFO] [1578979608.520339407]: current scan mode: Stability, max_distance: 18.0 m, Point number: 4.0K , angle_compensate: 1
[INFO] [1578979612.232194]: serial port: /dev/roomba
[INFO] [1578979612.233236]: update_rate: 30.0
[INFO] [1578979612.233995]: drive mode: twist
[INFO] [1578979612.234719]: has gyro: False
[ INFO] [1578979618.852178992]: Initializing Odom sensor
[ WARN] [1578979618.856105072]: Joint state with name: "back_castor_joint" was received but not found in URDF
[ INFO] [1578979618.913937151]: Odom sensor activated
[ INFO] [1578979618.998695797]: Kalman filter initialized with odom measurement
[ WARN] [1578979628.994519160]: Joint state with name: "back_castor_joint" was received but not found in URDF
[ WARN] [1578979639.260493305]: Joint state with name: "back_castor_joint" was received but not found in URDF
7675t commented 4 years ago

I think the warnings are not the cause of the problem. They are just warnings.

Sorry, I have ran out of my ideas for shooting the trouble here. I suggest some ways to dig it .

It may some hardware problems. We've tried this turtlebot_create package with at least four roombas(500 and 600 series) and haven't experienced problem like this.

Good luck,

rwayong commented 4 years ago

I think the warnings are not the cause of the problem. They are just warnings.

Sorry, I have ran out of my ideas for shooting the trouble here. I suggest some ways to dig it .

  • here is the line to send cmd_vel to roomba. Insert debug print to check if something goes wrong
  • Try create_autonomy package to control your roomba. If it doesn't works, problem may be your roomba-side.

It may some hardware problems. We've tried this turtlebot_create package with at least four roombas(500 and 600 series) and haven't experienced problem like this.

Good luck,

Thanks for you time. I'll try roomblock package on different roomba. Last question, can you tell me the environment that you used when testing the turtlebot_create package or roomblock package? Like, the model number of roomba (642 or something), raspberry pi and its OS, etc.