ezWheelSAS/swd-services

Can not setup service on Ubuntu

Opened this issue · 3 comments

I'm trying to setup the service on Ubuntu 22.04. I'm using my own machine (right now a virtual machine with a USB can dongle)

I'm connected directlty on the CAN bus of teh started kit (I have disconnected the PC)

I have only installed the service for now

sudo echo "deb http://packages.ez-wheel.com:8081/ubuntu $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list
sudo wget -qO - http://packages.ez-wheel.com:8081/archive.key | sudo apt-key add -
sudo sudo apt update && sudo apt install swd-services

sudo ip link set down can0
sudo ip link set can0 up type can bitrate 1000000 restart-ms 100
sudo ip link set can0 txqueuelen 1000

unset LD_LIBRARY_PATH 
/usr/bin/dbus-launch > /tmp/SYSTEMCTL_dbus.id

export $(cat /tmp/SYS*.id) 
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/ezw/usr/lib 
/opt/ezw/usr/bin/ezw-smc-service /opt/ezw/usr/etc/ezw-smc-core/drive_config.ini

I have also modified /opt/ezw/usr/etc/ezw-smc-core/drive_config.ini to set nodeId to 4instead of 16

candump give sme this. So the bus seems to be alive.

candump can0
  can0  705   [1]  7F
  can0  704   [1]  7F
  can0  705   [1]  7F
  can0  704   [1]  7F
  can0  705   [1]  7F
  can0  704   [1]  7F
  can0  705   [1]  7F
  can0  704   [1]  7F
  can0  705   [1]  7F
  can0  704   [1]  7F
  can0  705   [1]  7F
  can0  704   [1]  7F
  can0  705   [1]  7F
  can0  704   [1]  7F

Buit it does not want to setup the PDOs

 /opt/ezw/usr/bin/ezw-smc-service /opt/ezw/usr/etc/ezw-smc-core/drive_config.ini

2024-1-30 11:1:4;SMCS;APP;INFO;Log init;
2024-1-30 11:1:4;SMCS;APP;INFO;main;116;ezw-log initialized;
2024-1-30 11:1:4;SMCS;APP;INFO;main;141;Core Version : 2.0.1-daa5833;
2024-1-30 11:1:4;SMCS;APP;INFO;load;49;Config;Parsing config file : /opt/ezw/usr/etc/ezw-smc-core/drive_config.ini;
[default] contextId = 12
[default] nodeId = 4
[default] coreNodeId = 17
[default] coreNodeIsMaster = true
[default] canDevice = can0
[default] dbusNamespace = smc_drive
[default] HWConfigurationEntry = SWD_CORE
[default] HWConfigurationFile = /opt/ezw/usr/etc/ezw-smc-core/configuration.json
[default] CANOpenEDSFile = /opt/ezw/usr/etc/ezw-canopen-dico/swd_core.eds
[default] contextId = 12
[default] nodeId = 4
[default] coreNodeId = 17
[default] coreNodeIsMaster = true
[default] canDevice = can0
[default] dbusNamespace = smc_drive
[default] HWConfigurationEntry = SWD_CORE
[default] HWConfigurationFile = /opt/ezw/usr/etc/ezw-smc-core/configuration.json
[default] CANOpenEDSFile = /opt/ezw/usr/etc/ezw-canopen-dico/swd_core.eds
2024-1-30 11:1:4;SMCS;SMCDS;WARN;load;44;Config;Invalid type for SWCompatibilityFile;
2024-1-30 11:1:4;SMCS;SMCDS;INFO;getHWConfigurationMember;90;HardwareHelper;Search for entry SWD_CORE / nbStepRevolutionElectype Integer into /opt/ezw/usr/etc/ezw-smc-core/configuration.json;
2024-1-30 11:1:4;SMCS;SMCDS;INFO;getHWConfigurationMember;111;HardwareHelper;nbStepRevolutionElec : 6;
2024-1-30 11:1:4;SMCS;SMCDS;INFO;getHWConfigurationMember;90;HardwareHelper;Search for entry SWD_CORE / nbPolePairtype Integer into /opt/ezw/usr/etc/ezw-smc-core/configuration.json;
2024-1-30 11:1:4;SMCS;SMCDS;INFO;getHWConfigurationMember;111;HardwareHelper;nbPolePair : 5;
2024-1-30 11:1:4;SMCS;SMCDS;INFO;getHWConfigurationMember;145;HardwareHelper;Search for entry SWD_CORE / reduction type Double into /opt/ezw/usr/etc/ezw-smc-core/configuration.json;
2024-1-30 11:1:4;SMCS;SMCDS;INFO;getHWConfigurationMember;166;HardwareHelper;reduction : 14.000000;
2024-1-30 11:1:4;SMCS;SMCDS;INFO;getHWConfigurationMember;145;HardwareHelper;Search for entry SWD_CORE / diameter type Double into /opt/ezw/usr/etc/ezw-smc-core/configuration.json;
2024-1-30 11:1:4;SMCS;SMCDS;INFO;getHWConfigurationMember;166;HardwareHelper;diameter : 125.000000;
2024-1-30 11:1:4;SMCS;COS;INFO;init;56;Controller;Initializing ezw-canopen;
2024-1-30 11:1:4;SMCS;CAN;INFO;codrvTimerSetup;168; codrvTimerSetup : HW Timer inited by app !;
2024-1-30 11:1:4;SMCS;CAN;INFO;ezw_canopen_init;218;coNmtStateReq : Master Node 0x11 mode CO_NMT_STATE_OPERATIONAL;
2024-1-30 11:1:4;SMCS;CAN;INFO;nmtInd;117; HB Event on node 0x11: Node set to mode 2;
2024-1-30 11:1:4;SMCS;CAN;INFO;nmtInd;132; New Nmt state CO_NMT_STATE_OPERATIONAL - execute 0 - Node 0x11;
2024-1-30 11:1:4;SMCS;CAN;INFO;nmtInd;117; HB Event on node 0x11: Node set to mode 2;
2024-1-30 11:1:4;SMCS;CAN;INFO;nmtInd;132; New Nmt state CO_NMT_STATE_OPERATIONAL - execute 1 - Node 0x11;
2024-1-30 11:1:4;SMCS;COS;INFO;init;71;Controller;Initializing Timer Thread;
2024-1-30 11:1:4;SMCS;COS;INFO;init;81;Controller;Initializing CANOpenManager;
2024-1-30 11:1:4;SMCS;COS;WARN;loadNodes;43;CANOpenNodeCollectionFactory;No Node file specified !;
2024-1-30 11:1:4;SMCS;SMCDS;INFO;init;89;Init Success;
2024-1-30 11:1:4;SMCS;COS;INFO;can_init;120;Controller;Initializing Transmit Thread;
2024-1-30 11:1:4;SMCS;SMCDS;INFO;main;187;Main : start main loop;
2024-1-30 11:1:4;SMCS;CAN;WARN;ezw_can_process;541; process : Reader thread stopped, restarting it;
2024-1-30 11:1:4;SMCS;CAN;INFO;canInd;314; Bus On;
2024-1-30 11:1:4;SMCS;CAN;WARN;commInd;348; Tr Queue Empty;
2024-1-30 11:1:4;SMCS;CAN;INFO;hbState;275; HB Event on node 0x04: event: CO_ERRCTRL_HB_STARTED, nmtState: CO_NMT_STATE_PREOP;
2024-1-30 11:1:4;SMCS;CAN;INFO;hbState;278; HB Event on node 0x04: Node set to mode 1;
2024-1-30 11:1:4;SMCS;CAN;INFO;hbState;288;coNmtStateReq : Master Node 0x11 mode CO_NMT_STATE_OPERATIONAL;
2024-1-30 11:1:4;SMCS;CAN;INFO;hbState;275; HB Event on node 0x04: event: CO_ERRCTRL_NEW_STATE, nmtState: CO_NMT_STATE_PREOP;
2024-1-30 11:1:4;SMCS;CAN;INFO;hbState;278; HB Event on node 0x04: Node set to mode 1;
2024-1-30 11:1:4;SMCS;CAN;INFO;hbState;288;coNmtStateReq : Master Node 0x11 mode CO_NMT_STATE_OPERATIONAL;
2024-1-30 11:1:4;SMCS;CAN;WARN;sdoClientIndCommon;566; Got an error code : 0x05040000 (NodeID = 0x04, Index = 0x1400:0x02) : SDO protocol timed out;
2024-1-30 11:1:4;SMCS;COS;ERROR;sendSDOReadRequest;168;6; sendSDOReadRequest failed : 1 retry;
2024-1-30 11:1:4;SMCS;CAN;WARN;sdoClientIndCommon;566; Got an error code : 0x05040000 (NodeID = 0x04, Index = 0x1400:0x02) : SDO protocol timed out;
2024-1-30 11:1:4;SMCS;COS;ERROR;sendSDOReadRequest;168;6; sendSDOReadRequest failed : 2 retry;
2024-1-30 11:1:4;SMCS;CAN;WARN;sdoClientIndCommon;566; Got an error code : 0x05040000 (NodeID = 0x04, Index = 0x1400:0x02) : SDO protocol timed out;
2024-1-30 11:1:4;SMCS;COS;ERROR;sendSDOReadRequest;168;6; sendSDOReadRequest failed : 3 retry;
2024-1-30 11:1:4;SMCS;CAN;WARN;sdoClientIndCommon;566; Got an error code : 0x05040000 (NodeID = 0x04, Index = 0x2202:0x00) : SDO protocol timed out;
2024-1-30 11:1:4;SMCS;COS;ERROR;sendSDOReadRequest;168;6; sendSDOReadRequest failed : 1 retry;
2024-1-30 11:1:4;SMCS;CAN;WARN;sdoClientIndCommon;566; Got an error code : 0x05040000 (NodeID = 0x04, Index = 0x2202:0x00) : SDO protocol timed out;
2024-1-30 11:1:5;SMCS;COS;ERROR;sendSDOReadRequest;168;6; sendSDOReadRequest failed : 2 retry;
2024-1-30 11:1:5;SMCS;CAN;WARN;sdoClientIndCommon;566; Got an error code : 0x05040000 (NodeID = 0x04, Index = 0x2202:0x00) : SDO protocol timed out;
2024-1-30 11:1:5;SMCS;COS;ERROR;sendSDOReadRequest;168;6; sendSDOReadRequest failed : 3 retry;
2024-1-30 11:1:5;SMCS;CAN;WARN;sdoClientIndCommon;566; Got an error code : 0x05040000 (NodeID = 0x04, Index = 0x2202:0x00) : SDO protocol timed out;
2024-1-30 11:1:5;SMCS;COS;ERROR;sendSDOReadRequest;168;6; sendSDOReadRequest failed : 4 retry;
2024-1-30 11:1:5;SMCS;CAN;WARN;sdoClientIndCommon;566; Got an error code : 0x05040000 (NodeID = 0x04, Index = 0x2202:0x00) : SDO protocol timed out;
2024-1-30 11:1:5;SMCS;COS;ERROR;sendSDOReadRequest;168;6; sendSDOReadRequest failed : 5 retry;
2024-1-30 11:1:5;SMCS;COS;ERROR;readObject;244;6;sendSDOReadRequest nodeId=4 index=0x2202 subindex=0x0 failed !;
2024-1-30 11:1:5;SMCS;SMCDS;ERROR;get_value_by_name;315;CANOpenDispatcher;getValue nodeId=4 address=570556448 (Software version) : failed !;
2024-1-30 11:1:5;SMCS;CAN;ERROR;operator();374;Initialize PDO failed;
2024-1-30 11:1:5;SMCS;SMCDS;INFO;main;210;Initializing dbus service !;
2024-1-30 11:1:5;SMCS;SMCDS;INFO;registerService;39;Successfully registered service : commonapi.ezw.smcservice.smc_drive;
2024-1-30 11:1:5;SMCS;SMCDS;INFO;registerService;39;Successfully registered service : commonapi.ezw.smcservice.smc_drive;
2024-1-30 11:1:5;SMCS;SMCDS;INFO;registerService;39;Successfully registered service : commonapi.ezw.smcservice.smc_drive;
2024-1-30 11:1:5;SMCS;SMCDS;INFO;registerService;39;Successfully registered service : commonapi.ezw.smcservice.smc_drive;
2024-1-30 11:1:5;SMCS;SMCDS;INFO;registerService;39;Successfully registered service : commonapi.ezw.smcservice.smc_drive;
2024-1-30 11:1:5;SMCS;SMCDS;INFO;registerService;39;Successfully registered service : commonapi.ezw.smcservice.smc_drive;
2024-1-30 11:1:5;SMCS;SMCDS;INFO;registerService;39;Successfully registered service : commonapi.ezw.smcservice.smc_drive;
2024-1-30 11:1:5;SMCS;SMCDS;INFO;registerService;39;Successfully registered service : commonapi.ezw.smcservice.smc_drive;
2024-1-30 11:1:5;SMCS;SMCDS;INFO;registerService;39;Successfully registered service : commonapi.ezw.smcservice.smc_drive;
2024-1-30 11:1:5;SMCS;SMCDS;INFO;registerService;39;Successfully registered service : commonapi.ezw.smcservice.smc_drive;
2024-1-30 11:1:5;SMCS;SMCDS;INFO;registerService;39;Successfully registered service : commonapi.ezw.smcservice.smc_drive;

What am I doing wrong ?

Please refer to swd controllers repository : Usage A- On the SWD® Starter Kit.

It seems you did not set-up the configuration files correctly:

  1. The left SWD,
  2. The right SWD,
  3. The JSON,
    as mentionned below:

swd_left_config.ini

# SMC Drive service config file (SWD left)
contextId = 12
nodeId = 4
coreNodeId = 6
coreNodeIsMaster = true # Slave:false Master:true
canDevice = can0
dbusNamespace = swd_left

HWConfigurationEntry = SWD_CORE
HWConfigurationFile = /opt/ezw/data/configuration.json

CANOpenEDSFile = /opt/ezw/usr/etc/ezw-canopen-dico/swd_core.eds

swd_right_config.ini

# SMC Drive service config file  (SWD right)
contextId = 12
nodeId = 5
coreNodeId = 7
coreNodeIsMaster = true # Slave:false Master:true
canDevice = can0
dbusNamespace = swd_right

HWConfigurationEntry = SWD_CORE
HWConfigurationFile = /opt/ezw/data/configuration.json

CANOpenEDSFile = /opt/ezw/usr/etc/ezw-canopen-dico/swd_core.eds

configuration.json

[
   {
      "name": "SWD_CORE",
      "nbStepRevolutionElec": 6,
      "nbPolePair": 5,
      "reduction": 14.0,
      "diameter": 125.0
   }
]

Still not working.

Here is what I have:

/opt/ezw/usr/etc/ezw-smc-core/drive_config.ini

# SMC Drive service config file
contextId = 12
nodeId = 4
coreNodeId = 6
coreNodeIsMaster = true # Slave:false Master:true
canDevice = can0
dbusNamespace = swd_left#smc_drive

HWConfigurationEntry = SWD_CORE
HWConfigurationFile = /opt/ezw/usr/etc/ezw-smc-core/configuration.json

CANOpenEDSFile = /opt/ezw/usr/etc/ezw-canopen-dico/swd_core.eds

/opt/ezw/usr/etc/ezw-smc-core/configuration.json

                                              
[
{
"name": "SWD_CORE",
"nbStepRevolutionElec": 6,
"nbPolePair": 5,
"reduction": 14.0,
"diameter": 125.0
}
]

/opt/ezw/usr/etc/ezw-smc-core/swd_left_config.ini

# SMC Drive service config file
contextId = 12
nodeId = 4
coreNodeId = 6
coreNodeIsMaster = true # Slave:false Master:true
canDevice = can0
dbusNamespace = swd_left#smc_drive

HWConfigurationEntry = SWD_CORE
HWConfigurationFile = /opt/ezw/usr/etc/ezw-smc-core/configuration.json

CANOpenEDSFile = /opt/ezw/usr/etc/ezw-canopen-dico/swd_core.eds

/opt/ezw/usr/etc/ezw-smc-core/swd_right_config.ini

contextId = 12
nodeId = 5
coreNodeId = 7
coreNodeIsMaster = true # Slave:false Master:true
canDevice = can0
dbusNamespace = swd_right

HWConfigurationEntry = SWD_CORE
HWConfigurationFile = /opt/ezw/data/configuration.json

CANOpenEDSFile = /opt/ezw/usr/etc/ezw-canopen-dico/swd_core.eds

When I call /opt/ezw/usr/bin/ezw-smc-service /opt/ezw/usr/etc/ezw-smc-core/drive_config.ini

I still have this error:

Initialize PDO failed;

Hi @LudoJ49,

It seems that ezw-smc service is not connected to the correct node id.
=> CANOpen SDO requests failed

2024-2-7 20:27:48;SMCS;APP;ERROR;getExternalBrakePresence;1164;SMC Controller is not yet ready;
2024-2-7 20:27:48;SMCS;CAN;WARN;ezw_can_process;541;<ezw-can> process : Reader thread stopped, restarting it;
2024-2-7 20:27:48;SMCS;CAN;WARN;sdoClientIndCommon;566;<sdoClientIndCommon> Got an error code : 0x05040000 (NodeID = 0x04, Index = 0x1400:0x01) : SDO protocol timed out;
2024-2-7 20:27:48;SMCS;COS;ERROR;sendSDOReadRequest;168;6;<ezw-canopen-core> sendSDOReadRequest failed : 1 retry;
2024-2-7 20:27:48;SMCS;CAN;WARN;sdoClientIndCommon;566;<sdoClientIndCommon> Got an error code : 0x05040000 (NodeID = 0x04, Index = 0x1400:0x01) : SDO protocol timed out;
2024-2-7 20:27:48;SMCS;COS;ERROR;sendSDOReadRequest;168;6;<ezw-canopen-core> sendSDOReadRequest failed : 2 retry;
2024-2-7 20:27:48;SMCS;CAN;WARN;sdoClientIndCommon;566;<sdoClientIndCommon> Got an error code : 0x05040000 (NodeID = 0x04, Index = 0x1400:0x01) : SDO protocol timed out;
2024-2-7 20:27:48;SMCS;COS;ERROR;sendSDOReadRequest;168;6;<ezw-canopen-core> sendSDOReadRequest failed : 3 retry;
2024-2-7 20:27:48;SMCS;CAN;WARN;sdoClientIndCommon;566;<sdoClientIndCommon> Got an error code : 0x05040000 (NodeID = 0x04, Index = 0x1400:0x01) : SDO protocol timed out;
2024-2-7 20:27:48;SMCS;COS;ERROR;sendSDOReadRequest;168;6;<ezw-canopen-core> sendSDOReadRequest failed : 4 retry;
2024-2-7 20:27:48;SMCS;CAN;WARN;sdoClientIndCommon;566;<sdoClientIndCommon> Got an error code : 0x05040000 (NodeID = 0x04, Index = 0x1400:0x01) : SDO protocol timed out;
2024-2-7 20:27:48;SMCS;COS;ERROR;sendSDOReadRequest;168;6;<ezw-canopen-core> sendSDOReadRequest failed : 5 retry;
2024-2-7 20:27:48;SMCS;COS;ERROR;readObject;244;6;sendSDOReadRequest nodeId=4 index=0x1400 subindex=0x1 failed !;
2024-2-7 20:27:48;SMCS;SMCDS;ERROR;get_value_by_address;290;CANOpenDispatcher;getValue nodeId=4 address=335544608;
2024-2-7 20:27:48;SMCS;CAN;ERROR;operator();374;Initialize PDO failed;

As a workaround, launch the SWD remote.py on the Dbus instance and try to connect to an other node id:
=> 4 or 5 in your case
=> key 'i' in the menu

./remote.py smc_drive 
or ./remote.py swd_left 
or ./remote.py swd_right

Enter NodeId to connect on ?
NodeId [16]: 5

Wait a few seconds and check again.
2024-2-7 20:30:42;SMCS;CAN;INFO;hbState;288;coNmtStateReq : Master Node 0x11 mode CO_NMT_STATE_OPERATIONAL; 2024-2-7 20:30:42;SMCS;CAN;INFO;hbState;275;<hbInd> HB Event on node 0x05: event: CO_ERRCTRL_NEW_STATE, nmtState: CO_NMT_STATE_PREOP; 2024-2-7 20:30:42;SMCS;CAN;INFO;hbState;278;<hbInd> HB Event on node 0x05: Node set to mode 1; 2024-2-7 20:30:42;SMCS;CAN;INFO;hbState;288;coNmtStateReq : Master Node 0x11 mode CO_NMT_STATE_OPERATIONAL; 2024-2-7 20:30:43;SMCS;SMCDS;INFO;updatePdoCobIdSettings;481;CANOpenDispatcher;RPDO 1 enabled; 2024-2-7 20:30:43;SMCS;SMCDS;INFO;updatePdoCobIdSettings;490;CANOpenDispatcher;PDO address detected into RPDO 1 : 0x60400010; 2024-2-7 20:30:43;SMCS;SMCDS;INFO;updatePdoCobIdSettings;538;CANOpenDispatcher;TPDO 1 enabled; 2024-2-7 20:30:43;SMCS;SMCDS;INFO;updatePdoCobIdSettings;546;CANOpenDispatcher;PDO address detected into TPDO 1 : 0x26200208; 2024-2-7 20:30:43;SMCS;SMCDS;INFO;updatePdoCobIdSettings;538;CANOpenDispatcher;TPDO 3 enabled; 2024-2-7 20:30:43;SMCS;SMCDS;INFO;updatePdoCobIdSettings;546;CANOpenDispatcher;PDO address detected into TPDO 3 : 0x60410010; 2024-2-7 20:30:43;SMCS;SMCDS;INFO;updatePdoCobIdSettings;546;CANOpenDispatcher;PDO address detected into TPDO 3 : 0x60640020; 2024-2-7 20:30:43;SMCS;SMCDS;INFO;updatePdoCobIdSettings;481;CANOpenDispatcher;RPDO 4 enabled; 2024-2-7 20:30:43;SMCS;SMCDS;INFO;updatePdoCobIdSettings;490;CANOpenDispatcher;PDO address detected into RPDO 4 : 0x60400010; 2024-2-7 20:30:43;SMCS;SMCDS;INFO;updatePdoCobIdSettings;490;CANOpenDispatcher;PDO address detected into RPDO 4 : 0x60420010; 2024-2-7 20:30:43;SMCS;SMCDS;INFO;updatePdoCobIdSettings;538;CANOpenDispatcher;TPDO 4 enabled; 2024-2-7 20:30:43;SMCS;SMCDS;INFO;updatePdoCobIdSettings;546;CANOpenDispatcher;PDO address detected into TPDO 4 : 0x60410010; 2024-2-7 20:30:43;SMCS;SMCDS;INFO;updatePdoCobIdSettings;546;CANOpenDispatcher;PDO address detected into TPDO 4 : 0x606C0020; 2024-2-7 20:30:43;SMCS;CAN;INFO;operator();340;Initialize PDO success;