jsk-ros-pkg / jsk_robot

jsk-ros-pkg/jsk_robot
https://github.com/jsk-ros-pkg/jsk_robot
73 stars 97 forks source link

[jsk_fetch_startup] [switchbot_ros] The `switchbot_ros` raises many `DeviceInternalError` #1917

Open mqcmd196 opened 1 month ago

mqcmd196 commented 1 month ago

switchbot_ros in jsk_fetch_startup raises DeviceInternalError every time it respawns.

It also happens when it is launched independently.

fetch@fetch1075:~$ roslaunch switchbot_ros switchbot.launch token:=/var/lib/robot/switchbot_token.txt
... logging to /home/fetch/.ros/log/832647ae-29e1-11ef-9606-9fa99991a4b1/roslaunch-fetch1075-14845.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
WARNING: disk usage in log directory [/home/fetch/.ros/log] is over 1GB.
It's recommended that you use the 'rosclean' command.

started roslaunch server http://fetch1075:38895/

SUMMARY
========

PARAMETERS
 * /rosdistro: melodic
 * /rosversion: 1.14.13
 * /switchbot_ros/token: /var/lib/robot/sw...

NODES
  /
    switchbot_ros (switchbot_ros/switchbot_ros_server.py)

ROS_MASTER_URI=http://fetch1075:11311

process[switchbot_ros-1]: started with pid [14988]
Traceback (most recent call last):
  File "/home/fetch/ros/melodic/src/jsk-ros-pkg/jsk_3rdparty/switchbot_ros/scripts/switchbot_ros_server.py", line 121, in <module>
    server = SwitchBotAction()
  File "/home/fetch/ros/melodic/src/jsk-ros-pkg/jsk_3rdparty/switchbot_ros/scripts/switchbot_ros_server.py", line 30, in __init__
    self.bots = self.get_switchbot_client()
  File "/home/fetch/ros/melodic/src/jsk-ros-pkg/jsk_3rdparty/switchbot_ros/scripts/switchbot_ros_server.py", line 43, in get_switchbot_client
    client = SwitchBotAPIClient(token=self.token)
  File "/home/fetch/ros/melodic/src/jsk-ros-pkg/jsk_3rdparty/switchbot_ros/src/switchbot_ros/switchbot.py", line 21, in __init__
    self.update_device_list()
  File "/home/fetch/ros/melodic/src/jsk-ros-pkg/jsk_3rdparty/switchbot_ros/src/switchbot_ros/switchbot.py", line 85, in update_device_list
    res = self.request()
  File "/home/fetch/ros/melodic/src/jsk-ros-pkg/jsk_3rdparty/switchbot_ros/src/switchbot_ros/switchbot.py", line 76, in request
    raise DeviceInternalError()
switchbot_ros.switchbot.DeviceInternalError: Device internal error due to device states not synchronized with server. Or command format is invalid
[switchbot_ros-1] process has died [pid 14988, exit code 1, cmd /home/fetch/ros/melodic/devel/lib/switchbot_ros/switchbot_ros_server.py __name:=switchbot_ros __log:=/home/fetch/.ros/log/832647ae-29e1-11ef-9606-9fa99991a4b1/switchbot_ros-1.log].
log file: /home/fetch/.ros/log/832647ae-29e1-11ef-9606-9fa99991a4b1/switchbot_ros-1*.log
[switchbot_ros-1] restarting process
process[switchbot_ros-1]: started with pid [15127]
Traceback (most recent call last):
  File "/home/fetch/ros/melodic/src/jsk-ros-pkg/jsk_3rdparty/switchbot_ros/scripts/switchbot_ros_server.py", line 121, in <module>
    server = SwitchBotAction()
  File "/home/fetch/ros/melodic/src/jsk-ros-pkg/jsk_3rdparty/switchbot_ros/scripts/switchbot_ros_server.py", line 30, in __init__
    self.bots = self.get_switchbot_client()
  File "/home/fetch/ros/melodic/src/jsk-ros-pkg/jsk_3rdparty/switchbot_ros/scripts/switchbot_ros_server.py", line 43, in get_switchbot_client
    client = SwitchBotAPIClient(token=self.token)
  File "/home/fetch/ros/melodic/src/jsk-ros-pkg/jsk_3rdparty/switchbot_ros/src/switchbot_ros/switchbot.py", line 21, in __init__
    self.update_device_list()
  File "/home/fetch/ros/melodic/src/jsk-ros-pkg/jsk_3rdparty/switchbot_ros/src/switchbot_ros/switchbot.py", line 85, in update_device_list
    res = self.request()
  File "/home/fetch/ros/melodic/src/jsk-ros-pkg/jsk_3rdparty/switchbot_ros/src/switchbot_ros/switchbot.py", line 76, in request
    raise DeviceInternalError()
switchbot_ros.switchbot.DeviceInternalError: Device internal error due to device states not synchronized with server. Or command format is invalid
[switchbot_ros-1] process has died [pid 15127, exit code 1, cmd /home/fetch/ros/melodic/devel/lib/switchbot_ros/switchbot_ros_server.py __name:=switchbot_ros __log:=/home/fetch/.ros/log/832647ae-29e1-11ef-9606-9fa99991a4b1/switchbot_ros-1.log].
log file: /home/fetch/.ros/log/832647ae-29e1-11ef-9606-9fa99991a4b1/switchbot_ros-1*.log
[switchbot_ros-1] restarting process
process[switchbot_ros-1]: started with pid [15247]
^C[switchbot_ros-1] killing on exit
Traceback (most recent call last):
  File "/home/fetch/ros/melodic/src/jsk-ros-pkg/jsk_3rdparty/switchbot_ros/scripts/switchbot_ros_server.py", line 120, in <module>
    rospy.init_node('switchbot')
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/client.py", line 323, in init_node
    raise rospy.exceptions.ROSInitException("init_node interrupted before it could complete")
rospy.exceptions.ROSInitException: init_node interrupted before it could complete
shutting down processing monitor...
... shutting down processing monitor complete
done

DeviceInternalError seems to be raised when the API returns 190 code. It means Device internal error due to device states not synchronized with server as official doc says. Did something happen in 73B2's switchbot configuration?