ezWheelSAS / swd_ros_controllers

ROS nodes to control motors powered by the ez-Wheel Safety Wheel Drive (SWD®) technology.
https://www.ez-wheel.com/
GNU Lesser General Public License v2.1
5 stars 4 forks source link

swd_diff_drive_controller.launch fails with swd-services v0.2.7 and swd-ros-controllers v3.3.0 #48

Closed suguruhamada1003910 closed 2 years ago

suguruhamada1003910 commented 2 years ago

I bought SWD Starterkit and it ran properly. Then, I installed swd-services v0.2.7 and swd-ros-controllers v3.3.0 with apt command. SWD do not run properly now.

Information is below.

atmobi@atmobi-box:~$ systemctl -a | grep ezw
  ezw-dbus-user-session.service                                                                                    loaded    active     running   EZW DBUS USER SESSION SERVICE                                                                   
  ezw-ros-bringup.service                                                                                          loaded    active     running   EZW ROS BRINGUP SERVICE                                                                         
  ezw-stack.service                                                                                                loaded    active     running   EZW APP STARTUP - PARENT SERVICE                                                                
  ezw-swd-left.service                                                                                             loaded    active     running   EZW SWD LEFT SERVICE                                                                            
  ezw-swd-right.service                                                                                            loaded    active     running   EZW SWD RIGHT SERVICE        
atmobi@atmobi-box:~$ python3 /opt/ezw/usr/sbin/remote.py swd_left
SYSTEMCTL_dbus.id detected
DBUS Instance        : swd_left ..................................................................... [OK]
Node ID              : 0x4 .......................................................................... [OK]
RT activated         : True ......................................................................... [OK]
CAN device           : can0 ......................................................................... [OK]
Vendor-Id            : 0x515 ........................................................................ [OK]
Product code         : 0x10001 ...................................................................... [OK]
Serial number        : 22150SC038A1 ................................................................. [OK]
Revision number      : 4 ............................................................................ [OK]
SWVersion            : 1.0.1 ........................................................................ [OK]
HWVersion            : 3.0.0 ........................................................................ [OK]
Calibrated           : True ......................................................................... [OK]
SRDO validity        : True ......................................................................... [OK]
NMT state on error   : 1 ............................................................................ [OK]
NMT State            : PREOP  ....................................................................... [OK]
PDS State            : NOT_READY_TO_SWITCH_ON  ...................................................... [OK]
NbError              : 0 ............................................................................ [OK]
LastError            : 0 : Error_reset_or_no_error .................................................. [OK]
SystemError          : EZW_PROTECT_NONE EZW_PROTECT_NONE  ........................................... [OK]
SSW CAN1             : False, False, False, False, False, False, False, False  ...................... [OK]
SSW CAN2             : False, False, False, False, False, False, False, False  ...................... [OK]
SSW CAN3             : False, False, False, False, False, False, False, False  ...................... [OK]
SSW CAN4             : False, False, False, False, False, False, False, False  ...................... [OK]
SSW CAN5             : False, False, False, False, False, False, False, False  ...................... [OK]
SSW CAN6             : False, False, False, False, False, False, False, False  ...................... [OK]
SSW CAN7             : False, False, False, False, False, False, False, False  ...................... [OK]
SSW CAN8             : False, False, False, False, False, False, False, False  ...................... [OK]
SSW SAFEOUT          : False, False, False, False, False, False, False, False  ...................... [OK]
SCW SAFEIN_1         : True, True, True, True, True, True, True, True  .............................. [OK]
Peripheral           : True, True, True, False, True, True  ......................................... [OK]
VelocityModeSW       : internal_limit_active: False ................................................. [OK]
VelocityModeCW       : enable_ramp: False, unlock_ramp: False, reference_ramp: False, halt: False ... [OK]
Polarity             : velocity_polarity: True, position_polarity: True ............................. [OK]
TargetVelocity       : 0 ............................................................................ [OK]
VelocityDemand       : 0 ............................................................................ [OK]
VelocityActualValue  : 0 ............................................................................ [OK]
PositionValue        : -3 ........................................................................... [OK]
OdometryValue        : -2 ........................................................................... [OK]
<COM> Connect NodeID = i Disconnect = d Restore param = j
<NMT> RESET_NODE = r Start all = m
<PDS> Go to OPERATION_ENABLED = o
<VL mode> target velocity (500) = +/- positive order = 8 negative order = 2 stop = *
<Param> STO_ACK off/on = f/n
<Mode> local = w remote = z
<Diagnostic> a
<EMCY> get full EMCY list = e, clear EMCY list = c
<SW> s
<quit> 0
Traceback (most recent call last):
  File "/opt/ezw/usr/sbin/remote.py", line 549, in <module>
    main(sys.argv[1:])
  File "/opt/ezw/usr/sbin/remote.py", line 544, in main
    menu_diagnostic()
  File "/opt/ezw/usr/sbin/remote.py", line 410, in menu_diagnostic
    menu_actions["root_menu"]()
  File "/opt/ezw/usr/sbin/remote.py", line 153, in root_menu
    choice = getch()
  File "/opt/ezw/usr/sbin/remote.py", line 67, in getch
    c = sys.stdin.read(1)
KeyboardInterrupt
atmobi@atmobi-box:~$ python3 /opt/ezw/usr/sbin/remote.py swd_right
SYSTEMCTL_dbus.id detected
DBUS Instance        : swd_right .................................................................... [OK]
Node ID              : 0x5 .......................................................................... [OK]
RT activated         : True ......................................................................... [OK]
CAN device           : can0 ......................................................................... [OK]
Vendor-Id            : 0x515 ........................................................................ [OK]
Product code         : 0x10001 ...................................................................... [OK]
Serial number        : 22150SC031A1 ................................................................. [OK]
Revision number      : 4 ............................................................................ [OK]
SWVersion            : 1.0.1 ........................................................................ [OK]
HWVersion            : 3.0.0 ........................................................................ [OK]
Calibrated           : True ......................................................................... [OK]
SRDO validity        : True ......................................................................... [OK]
NMT state on error   : 1 ............................................................................ [OK]
NMT State            : PREOP  ....................................................................... [OK]
PDS State            : NOT_READY_TO_SWITCH_ON  ...................................................... [OK]
NbError              : 0 ............................................................................ [OK]
LastError            : 0 : Error_reset_or_no_error .................................................. [OK]
SystemError          : EZW_PROTECT_NONE EZW_PROTECT_NONE  ........................................... [OK]
SSW CAN1             : False, False, False, False, False, False, False, False  ...................... [OK]
SSW CAN2             : False, False, False, False, False, False, False, False  ...................... [OK]
SSW CAN3             : False, False, False, False, False, False, False, False  ...................... [OK]
SSW CAN4             : False, False, False, False, False, False, False, False  ...................... [OK]
SSW CAN5             : False, False, False, False, False, False, False, False  ...................... [OK]
SSW CAN6             : False, False, False, False, False, False, False, False  ...................... [OK]
SSW CAN7             : False, False, False, False, False, False, False, False  ...................... [OK]
SSW CAN8             : False, False, False, False, False, False, False, False  ...................... [OK]
SSW SAFEOUT          : False, False, False, False, False, False, False, False  ...................... [OK]
SCW SAFEIN_1         : True, True, False, False, False, False, True, True  .......................... [OK]
Peripheral           : True, True, True, False, True, True  ......................................... [OK]
VelocityModeSW       : internal_limit_active: False ................................................. [OK]
VelocityModeCW       : enable_ramp: False, unlock_ramp: False, reference_ramp: False, halt: False ... [OK]
Polarity             : velocity_polarity: False, position_polarity: False ........................... [OK]
TargetVelocity       : 0 ............................................................................ [OK]
VelocityDemand       : 0 ............................................................................ [OK]
VelocityActualValue  : 0 ............................................................................ [OK]
PositionValue        : -1 ........................................................................... [OK]
OdometryValue        : 0 ............................................................................ [OK]
<COM> Connect NodeID = i Disconnect = d Restore param = j
<NMT> RESET_NODE = r Start all = m
<PDS> Go to OPERATION_ENABLED = o
<VL mode> target velocity (500) = +/- positive order = 8 negative order = 2 stop = *
<Param> STO_ACK off/on = f/n
<Mode> local = w remote = z
<Diagnostic> a
<EMCY> get full EMCY list = e, clear EMCY list = c
<SW> s
<quit> 0
atmobi@atmobi-box:~$ roslaunch swd_ros_controllers swd_diff_drive_controller.launch 
... logging to /home/atmobi/.ros/log/81b0d2b6-5668-11ed-8d17-03aa7ac47ebf/roslaunch-atmobi-box-6016.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://localhost:37609/

SUMMARY
========

PARAMETERS
 * /rosdistro: noetic
 * /rosversion: 1.15.14
 * /swd_diff_drive_controller/base_frame: base_link
 * /swd_diff_drive_controller/baseline_m: 0.485
 * /swd_diff_drive_controller/command_timeout_ms: 500
 * /swd_diff_drive_controller/control_mode: Twist
 * /swd_diff_drive_controller/have_backward_sls: False
 * /swd_diff_drive_controller/left_encoder_relative_error: 0.2
 * /swd_diff_drive_controller/left_swd_config_file: /opt/ezw/usr/etc/...
 * /swd_diff_drive_controller/odom_frame: odom
 * /swd_diff_drive_controller/pub_freq_hz: 20
 * /swd_diff_drive_controller/publish_odom: True
 * /swd_diff_drive_controller/publish_safety_functions: True
 * /swd_diff_drive_controller/publish_tf: True
 * /swd_diff_drive_controller/right_encoder_relative_error: 0.2
 * /swd_diff_drive_controller/right_swd_config_file: /opt/ezw/usr/etc/...
 * /swd_diff_drive_controller/wheel_max_speed_rpm: 75
 * /swd_diff_drive_controller/wheel_safety_limited_speed_rpm: 40

NODES
  /
    swd_diff_drive_controller (swd_ros_controllers/swd_diff_drive_controller)

ROS_MASTER_URI=http://localhost:11311

process[swd_diff_drive_controller-1]: started with pid [6031]
[ INFO] [1666924738.388517162]: Ready !
[ INFO] [1666924738.402184789]: Initializing swd_diff_drive_controller, node name : /swd_diff_drive_controller
[ INFO] [1666924738.430186009]: Motors config files, right : /opt/ezw/usr/etc/ezw-smc-core/swd_right_config.ini, left : /opt/ezw/usr/etc/ezw-smc-core/swd_left_config.ini
2022-10-28 11:38:58;;APP;INFO;load;49;Config;Parsing config file : /opt/ezw/usr/etc/ezw-smc-core/swd_right_config.ini;
[default] contextId = 12
[default] nodeId = 5
[default] coreNodeId = 7
[default] coreNodeIsMaster = true
[default] canDevice = can0
[default] dbusNamespace = swd_right
[default] HWConfigurationEntry = SWD_CORE
[default] HWConfigurationFile = /opt/ezw/data/configuration.json
[default] CANOpenEDSFile = /opt/ezw/usr/etc/ezw-canopen-dico/swd_core.eds
[default] contextId = 12
[default] nodeId = 5
[default] coreNodeId = 7
[default] coreNodeIsMaster = true
[default] canDevice = can0
[default] dbusNamespace = swd_right
[default] HWConfigurationEntry = SWD_CORE
[default] HWConfigurationFile = /opt/ezw/data/configuration.json
[default] CANOpenEDSFile = /opt/ezw/usr/etc/ezw-canopen-dico/swd_core.eds
2022-10-28 11:38:58;;SMCDS;WARN;load;44;Config;Invalid type for SWCompatibilityFile;
2022-10-28 11:38:58;;SMCDS;INFO;getHWConfigurationMember;90;HardwareHelper;Search for entry SWD_CORE / nbStepRevolutionElectype Integer into /opt/ezw/data/configuration.json;
2022-10-28 11:38:58;;SMCDS;INFO;getHWConfigurationMember;111;HardwareHelper;nbStepRevolutionElec : 6;
2022-10-28 11:38:58;;SMCDS;INFO;getHWConfigurationMember;90;HardwareHelper;Search for entry SWD_CORE / nbPolePairtype Integer into /opt/ezw/data/configuration.json;
2022-10-28 11:38:58;;SMCDS;INFO;getHWConfigurationMember;111;HardwareHelper;nbPolePair : 5;
2022-10-28 11:38:58;;SMCDS;INFO;getHWConfigurationMember;145;HardwareHelper;Search for entry SWD_CORE / reduction type Double into /opt/ezw/data/configuration.json;
2022-10-28 11:38:58;;SMCDS;INFO;getHWConfigurationMember;166;HardwareHelper;reduction : 14.000000;
2022-10-28 11:38:58;;SMCDS;INFO;getHWConfigurationMember;145;HardwareHelper;Search for entry SWD_CORE / diameter type Double into /opt/ezw/data/configuration.json;
2022-10-28 11:38:58;;SMCDS;INFO;getHWConfigurationMember;166;HardwareHelper;diameter : 125.000000;
2022-10-28 11:38:58;;SMCDS;INFO;init;76;DBusClientDelegate;Checking DBUS proxy availability : commonapi.ezw.smcservice.swd_right;
2022-10-28 11:40:58;;SMCDS;ERROR;init;83;DBusClientDelegate;Checking DBus proxy availability timeout (120s) for proxy commonapi.ezw.smcservice.swd_right;
[ERROR] [1666924858.471717588]: Failed initializing right motor, EZW_ERR: SMCService : Controller::init() return error code : 5
[swd_diff_drive_controller-1] process has died [pid 6031, exit code 1, cmd /opt/ros/noetic/lib/swd_ros_controllers/swd_diff_drive_controller __name:=swd_diff_drive_controller __log:=/home/atmobi/.ros/log/81b0d2b6-5668-11ed-8d17-03aa7ac47ebf/swd_diff_drive_controller-1.log].
log file: /home/atmobi/.ros/log/81b0d2b6-5668-11ed-8d17-03aa7ac47ebf/swd_diff_drive_controller-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete
done

candump.txt

suguruhamada1003910 commented 2 years ago

I also installed swd-system-config-2wheels.

GMezWheel commented 2 years ago

Hi @suguruhamada1003910 ,

If you start manually swd_diff_drive_controller, you have to export DBus session environment variables: https://github.com/ezWheelSAS/swd_ros_controllers/#usage-on-a-swd-starter-kit export $(cat /tmp/SYSTEMCTL_dbus.id)

Otherwise, DBus error at startup: 2022-10-28 11:40:58;;SMCDS;ERROR;init;83;DBusClientDelegate;Checking DBus proxy availability timeout (120s) for proxy commonapi.ezw.smcservice.swd_right;

NOTA: remote.py found it by itself:

atmobi@atmobi-box:~$ python3 /opt/ezw/usr/sbin/remote.py swd_right
SYSTEMCTL_dbus.id detected
suguruhamada1003910 commented 2 years ago

@GMezWheel

Thank you for reply. I will try it. By the way, how does SWD Starterkit export it? I want to connect IPC and SWD automatically when power is ON.

GMezWheel commented 2 years ago

The automatic export of DBus session (if exists) is made by ezw-ros-bringup.service.

NOTA : if the IPC has already a DBus window manager session, the ezw-dbus-user-session.service can be disable. Thus, by default, swd_diff_drive_controller wil use DBus window manager session (no need to export DBus session environment variables).

suguruhamada1003910 commented 2 years ago
process 39532: arguments to dbus_set_error_from_message() were incorrect, assertion "(error) == NULL || !dbus_error_is_set ((error))" failed in file dbus-message.c line 3938.
This is normally a bug in some application using the D-Bus library.
  D-Bus not built with -rdynamic so unable to print a backtrace

I got new error message. Do you have any solution?

GMezWheel commented 2 years ago

Solution one

The dbus library is not the right one. Set "export LD_LIBRARY_PATH=/opt/ezw/usr/lib" before running application.

Solution two

If the IPC has a window manager installed, there is already a DBus session for it. Thus, remove and don't create /tmp/SYSTEMCTL_dbus.id file. Then :

suguruhamada1003910 commented 2 years ago
process 39532: arguments to dbus_set_error_from_message() were incorrect, assertion "(error) == NULL || !dbus_error_is_set ((error))" failed in file dbus-message.c line 3938.
This is normally a bug in some application using the D-Bus library.
  D-Bus not built with -rdynamic so unable to print a backtrace

I did not know the cause of this problem. I cannot resolve it. However, swd_diff_drive_controller.launch succeeded with other PC. So I close this.