Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting configuration files - single motor with MC4plus and single motor with EMS4 and 2foc #15

Open
plinioMoreno opened this issue Apr 30, 2021 · 22 comments

Comments

@plinioMoreno
Copy link
Member

We applied the changes from the pull request here, and we were not able to run the calibration type 5.

Regarding the MC4 plus, the behavior is the same as the initial test reported here and the most recent one here

Regarding the EMS4 with 2foc, the behavior is the same as the initial test reported here and the most recent one here

@davidetome and @ale-git let us know the next step here.

cc @pattacini @wevmacedo

@davidetome
Copy link
Contributor

davidetome commented Apr 30, 2021

Ciao @plinioMoreno and @wevmacedo,

first of all, you'll surely need to tune the PID gains as pointed out here.

You may start from a kp set to 400 and see if the motor moves (if not, increase it), then you can increase the ki to remove the position error

Here is an example for the joints of the iCub neck.

cc @ale-git @pattacini

@plinioMoreno
Copy link
Member Author

plinioMoreno commented Apr 30, 2021

The main issue from my point of view is that the calibration is not working, and I want to have this figured out before going to the PID tunning. The additional reason for this is that for our robot Vizzy, we already did the PID tunning and we know how to do it.

I guess that to have the calibration working we do not need the PID perfectly tunned, or do we have to do that first?

cc @ale-git @pattacini @wevmacedo

@davidetome
Copy link
Contributor

davidetome commented Apr 30, 2021

Ciao @plinioMoreno ,

if the PID gains are too small also the calibration will not work because the motor can't move, so you should increase them in order to have the motor moving/calibrating and then you can proceed w/ the fine tuning.

cc @ale-git @pattacini @wevmacedo

@plinioMoreno
Copy link
Member Author

Hi @davidetome,

In the current setups, both motors are moving in one direction up until the hard stop happens. For this to happen, I believe the PWM has to be set largely enough for the motor start to move. Then, after the hard stop, is the motor controlled using the PID? I'm asking this just to understand what to expect.

Regarding the PID setting, our motors are free (no gear box or anything attached to them), so I believe that a low value should work. In the case of the MC4 plus we should be able to do the PID tunning. But in the case of the 2foc connected to the EMS4, the joint goes to the state "Not configured" after executing the calibration, so we cannot control the joint. How can we setup the PID values in this case?

cc @ale-git @pattacini @wevmacedo

@pattacini
Copy link

For this to happen, I believe the PWM has to be set largely enough for the motor start to move. Then, after the hard stop, is the motor controlled using the PID? I'm asking this just to understand what to expect.

I'm not familiar with the calibration procedure per se but I know that certain types do require the PID controllers to work during the process, which are tuned with ad hoc gains.

@ale-git will get back to you with more info on this.

@ale-git
Copy link

ale-git commented May 4, 2021

HI @plinioMoreno, the PID is not used during type 5 calibration, but it is used in "go to startup position" after calibration.

<param name="startupPosition"> 0.00 </param>

With the MC4+ board it seems to me that the calibration is fine, but the joint can't reach the startup position after calibration. Probably it will after PID tuning. You should be able to change PID parameters at runtime by the yarpmotorgui as usual.

About the EMS+2FOC the board succeeds in type 5 calibration, but it doesn't exit from calibration state. Since the 2FOC firmware for DC motors was born to be used in the R1 torso, which has type 9 calibration (torso tripod), and it has never been used with calibration type 5, I have to examine the firmware to understand what's going on.

@plinioMoreno
Copy link
Member Author

Hi @ale-git, thank you for the explanation. We will work on the MC4+, setting the min and max values of the PID controller as pointed here by @davidetome.

About the EMS+2foc we will wait for your feedback on that.

@ale-git
Copy link

ale-git commented May 18, 2021

Hi @plinioMoreno,

I examinated the EMS firmware, and unfortunately I've found out that calibration type 5 is compatible only with MC4+ board controlled motors and not with EMS/2FOC. The 2FOC DC firmware is dedicated to R1 torso linear actuators, with hard stop calibration that involves three coupled motors. What we can do for you is to modify the calibration type 9 in the EMS firmware to make it comply with a single motor, providing the .hex file as well as the modified source files. Please notice that we'll not be able to maintain this separated version nor integrate it in the official iCub software, because it would involve modifications in all the iCub software framework. If it is ok for you we can proceed in this way.

@plinioMoreno
Copy link
Member Author

Hi @ale-git,
Many thanks for checking this. About the way to proceed, let me give you more context on this. In the near future we want to change all the control boards of our robot Vizzy to the ETH versions. Since our robot currently runs yarprobotinterface using the config files here, I wonder if we will run into problems running yarprobotinterface in case the EMS firmware does not match the required versions that the embobjlibrary asks for (That is the way I think it works). Let me know if this problem will happen, and if we can ask you to provide us with the newer .hex file when we need.

@pattacini
Copy link

Hi @plinioMoreno

Sorry to chime in at this point, but we need to account also for organizational aspects here.
Let me try to sum up:

Your side

  • At the moment, you don't have EMS onboard but you're stuck as calibration 5 is not meant for your setup equipped with 2FOC.
  • In the near future, you are going to mount EMS boards and you're worried that something will go wrong if we won't provide an official way through this calibration type.

Our side

  1. What we can do in this program increment (ending in July) is to give you the experimental FW plus the code to handle your setup w/ 2FOC. The backlog of our activities is very full and we cannot plan something more in this respect.
  2. We can put your request to manage a new calibration mode to address a setup with EMS + 2FOC on the bill of our next program increment.

If you deem that this plan looks good to you, we can proceed with points 1 and 2.
To address point 2, we would need to have the request correctly filed in https://github.com/robotology/icub-main/issues/new/choose. Would you be willing to do so?

Let us know!

@plinioMoreno
Copy link
Member Author

Hi @pattacini,

Thank you for the additional info. The plan sounds good to me, so you can proceed with the experimental FW plus the code to handle the setup. I will take care of the feature request during this week.

Thanks again @pattacini @ale-git @davidetome

@pattacini
Copy link

Great!
Let's do this way then.

@ale-git
Copy link

ale-git commented May 20, 2021

Hi @plinioMoreno, this is the .hex file
ems004.zip
and these are the three source files involved
Modfiles.zip
The calibration type that you have to use now is type 9, where only two parameters are used:

  • calibration1 is the calibration pwm
  • calibrationZero is the calibration offset
    Please let me know if it is working.

@wevmacedo
Copy link
Collaborator

Hi @ale-git,

We uploaded the firmware to the EMS board, and we got an error related to the firmware versions (see below). What is the procedure to have the same versions in the pc and in the control board?

[DEBUG] Reading file C:\robotology\eth-boards-setups\single-ETH-ems4-1-motor-test-vislab\.\test_knee_joint_V25.xml
[DEBUG] yarprobotinterface: using xml parser for DTD v3.x
[DEBUG] Reading file C:\robotology\eth-boards-setups\single-ETH-ems4-1-motor-test-vislab\.\test_knee_joint_V25.xml
[DEBUG] Preprocessor complete in:  0.0077564 s
[INFO] |yarp.os.Port| Port /icub/yarprobotinterface active at tcp://10.1.3.104:10002/
[INFO] startup phase starting...
[DEBUG] eth::parser::print(pc104Data) for PC104:
[DEBUG] PC104/PC104IpAddress:PC104IpPort =  10.1.3.104:12345
[DEBUG] PC104/PC104TXrate =  1
[DEBUG] PC104/PC104RXrate =  5
[DEBUG] EthSender is a PeriodicThread with txrate = 1 ms
[DEBUG] EthReceiver is a PeriodicThread with rxrate = 5 ms
[WARNING] in EthReceiver::config() the config socket has queue size =  1048576 ; you request ETHRECEIVER_BUFFER_SIZE=
[DEBUG] eth::parser::print(boardData) for BOARD knee-eb10-j1
[DEBUG] ETH_BOARD/ETH_BOARD_PROPERTIES:
[DEBUG] ETH_BOARD/ETH_BOARD_PROPERTIES/IpAddress =  10.1.3.11
[DEBUG] ETH_BOARD/ETH_BOARD_PROPERTIES/IpPort =  12345
[DEBUG] ETH_BOARD/ETH_BOARD_PROPERTIES/Type =  ems4
[DEBUG] ETH_BOARD/ETH_BOARD_PROPERTIES/maxSizeRXpacket =  768
[DEBUG] ETH_BOARD/ETH_BOARD_PROPERTIES/maxSizeROP =  384
[DEBUG] ETH_BOARD/ETH_BOARD_SETTINGS:
[DEBUG] ETH_BOARD/ETH_BOARD_SETTINGS/Name =  knee-eb10-j1
[DEBUG] ETH_BOARD/ETH_BOARD_SETTINGS/RUNNINGMODE/(period, maxTimeOfRXactivity, maxTimeOfDOactivity, maxTimeOfTXactivity, TXrateOfRegularROPs) =  1000 400 300 300 5
[DEBUG] ETH_BOARD/ETH_BOARD_ACTIONS/MONITOR_ITS_PRESENCE
[DEBUG] ETH_BOARD/ETH_BOARD_ACTIONS/MONITOR_ITS_PRESENCE/(enabled, timeout, periodOfMissingReport) =  true 0.02 60
[DEBUG] eth::EthMonitorPresence::config(): monitoring of presence is ON for BOARD 10.1.3.11 (knee-eb10-j1) with timeout = 0.02 sec and period of missing report = 60 sec
[DEBUG] TheEthManager::requestResource2(): has just succesfully created a new EthResource for board of type ems4 with IP =  10.1.3.11
[WARNING] embObjMC BOARD  knee-eb10-j1 Missing OTHER_CONTROL_PARAMETERS.DeadZone parameter. I'll use default value. (see documentation for more datails)
[DEBUG] embObjMC BOARD  knee-eb10-j1 :fromConfig() detected that IMPEDANCE parameters section is found
[INFO] embObjMC BOARD  knee-eb10-j1 IMPEDANCE section: parameters successfully loaded
[WARNING] AutoCalibration parameter not found for board knee-eb10-j1 in bottle "2FOC" (Autocalibration 0) (Verbose 1) (HasHallSensor 0) (HasTempSensor 0) (HasRotorEncoder 1) (HasRotorEncoderIndex 0) (HasSpeedEncoder 0) (RotorIndexOffset 0) (MotorPoles 2)
[WARNING] In  knee-eb10-j1  there isn't 2FOC.AutoCalibration filed. For default it is disabled
[INFO]  from BOARD 10.1.3.11 (└9☺♥S☺), src LOCAL, adr 0, time 194s 724m 489u: (code 0x00000034, par16 0x0001 par64 0x0000000000000003) -> SYS: the board has detected a restart of the remote transceiver because the rx ropframe sequence number is 1. In par64 there is the expected number. + .
[DEBUG] EthResource::verifyBoardPresence() found BOARD knee-eb10-j1 with IP 10.1.3.11 after 0.0038722 seconds
[ERROR] EthResource::verifyBoardTransceiver() detected different mn protocol minor versions: local = 17 , remote = 18 : cannot proceed any further.
[ERROR] ACTION REQUIRED: BOARD knee-eb10-j1 with IP 10.1.3.11 needs a FW update.
[ERROR] EthResource::verifyEPprotocol() cannot verify BOARD knee-eb10-j1 with IP 10.1.3.11 : cannot proceed any further
[ERROR] embObjMotionControl: failed verifyEPprotocol. Cannot continue!

cc plinioMoreno

@ale-git
Copy link

ale-git commented May 21, 2021

Hi @wevmacedo, it seems to me that your

https://github.com/robotology/yarp
https://github.com/robotology/icub-main
https://github.com/robotology/icub-firmware-shared/

are outdated with respect to the board firmware, so you have to update them.
You can find installation instructions in the repos.

@wevmacedo
Copy link
Collaborator

Hi @ale-git,

We updated the repos and we were able to run the test. The new calibration file is here. The behavior is as follows:

  1. The motor moves in the hardstop direction.
  2. We stop the motor, but the motor keeps moving in the same direction
  3. After the timeout, the motor stops and its status is NOT CONFIGURED

The output from the yarprobotinterface as follows:

[DEBUG] Reading file C:\robotology\eth-boards-setups\single-ETH-ems4-1-motor-test-vislab\.\test_knee_joint_V25.xml
[DEBUG] yarprobotinterface: using xml parser for DTD v3.x
[DEBUG] Reading file C:\robotology\eth-boards-setups\single-ETH-ems4-1-motor-test-vislab\.\test_knee_joint_V25.xml
[DEBUG] Preprocessor complete in:  0.0085389 s
[INFO] |yarp.os.Port| Port /icub/yarprobotinterface active at tcp://10.1.3.104:10002/
[INFO] startup phase starting...
[DEBUG] eth::parser::print(pc104Data) for PC104:
[DEBUG] PC104/PC104IpAddress:PC104IpPort =  10.1.3.104:12345
[DEBUG] PC104/PC104TXrate =  1
[DEBUG] PC104/PC104RXrate =  5
[DEBUG] EthSender is a PeriodicThread with txrate = 1 ms
[DEBUG] EthReceiver is a PeriodicThread with rxrate = 5 ms
[WARNING] in EthReceiver::config() the config socket has queue size =  1048576 ; you request ETHRECEIVER_BUFFER_SIZE=
[DEBUG] eth::parser::print(boardData) for BOARD knee-eb10-j1
[DEBUG] ETH_BOARD/ETH_BOARD_PROPERTIES:
[DEBUG] ETH_BOARD/ETH_BOARD_PROPERTIES/IpAddress =  10.1.3.11
[DEBUG] ETH_BOARD/ETH_BOARD_PROPERTIES/IpPort =  12345
[DEBUG] ETH_BOARD/ETH_BOARD_PROPERTIES/Type =  ems4
[DEBUG] ETH_BOARD/ETH_BOARD_PROPERTIES/maxSizeRXpacket =  768
[DEBUG] ETH_BOARD/ETH_BOARD_PROPERTIES/maxSizeROP =  384
[DEBUG] ETH_BOARD/ETH_BOARD_SETTINGS:
[DEBUG] ETH_BOARD/ETH_BOARD_SETTINGS/Name =  knee-eb10-j1
[DEBUG] ETH_BOARD/ETH_BOARD_SETTINGS/RUNNINGMODE/(period, maxTimeOfRXactivity, maxTimeOfDOactivity, maxTimeOfTXactivity, TXrateOfRegularROPs) =  1000 400 300 300 5
[DEBUG] ETH_BOARD/ETH_BOARD_ACTIONS/MONITOR_ITS_PRESENCE
[DEBUG] ETH_BOARD/ETH_BOARD_ACTIONS/MONITOR_ITS_PRESENCE/(enabled, timeout, periodOfMissingReport) =  true 0.02 60
[DEBUG] eth::EthMonitorPresence::config(): monitoring of presence is ON for BOARD 10.1.3.11 (knee-eb10-j1) with timeout = 0.02 sec and period of missing report = 60 sec
[DEBUG] TheEthManager::requestResource2(): has just succesfully created a new EthResource for board of type ems4 with IP =  10.1.3.11
[WARNING] embObjMC BOARD  knee-eb10-j1 Missing OTHER_CONTROL_PARAMETERS.DeadZone parameter. I'll use default value. (see documentation for more datails)
[DEBUG] embObjMC BOARD  knee-eb10-j1 :fromConfig() detected that IMPEDANCE parameters section is found
[INFO] embObjMC BOARD  knee-eb10-j1 IMPEDANCE section: parameters successfully loaded
[WARNING] AutoCalibration parameter not found for board knee-eb10-j1 in bottle "2FOC" (Autocalibration 0) (Verbose 1) (HasHallSensor 0) (HasTempSensor 0) (HasRotorEncoder 1) (HasRotorEncoderIndex 0) (HasSpeedEncoder 0) (RotorIndexOffset 0) (MotorPoles 2)
[WARNING] In  knee-eb10-j1  there isn't 2FOC.AutoCalibration filed. For default it is disabled
[INFO]  from BOARD 10.1.3.11 (└øò÷Á☺), src LOCAL, adr 0, time 2545s 217m 511u: (code 0x00000034, par16 0x0001 par64 0x0000000000000c54) -> SYS: the board has detected a restart of the remote transceiver because the rx ropframe sequence number is 1. In par64 there is the expected number. + .
[DEBUG] EthResource::verifyBoardPresence() found BOARD knee-eb10-j1 with IP 10.1.3.11 after 0.004893 seconds
[DEBUG] EthResource::verifyBoardTransceiver() has validated the transceiver of BOARD knee-eb10-j1 with IP 10.1.3.11
[DEBUG] EthResource::cleanBoardBehaviour() has cleaned the application in BOARD knee-eb10-j1 with IP 10.1.3.11 : config mode + cleared all its regulars
[DEBUG] EthResource::setTimingOfRunningCycle() for BOARD knee-eb10-j1 with IP 10.1.3.11 has succesfully set: cycletime = 1000 usec, RX DO TX = ( 400 300 300 ) usec and TX rate = 5  every cycle
[INFO] EthResource::askBoardVersion() found BOARD knee-eb10-j1 @ IP 10.1.3.11 of type ems4 with FW = ver 3.39 built on 2021 Apr 26 14:11
[DEBUG]  from BOARD 10.1.3.11 (└øò÷Á☺), src LOCAL, adr 0, time 2545s 264m 182u: (code 0x05000015, par16 0x1000 par64 0x00000000000f000f) -> CFG: EOtheEncoderReader can be correctly configured. p16&0xf000: number of joint; primary encs: failure mask in p16&0x000f and errorcodes in p64&0x0000ffff; secondary encs: failure mask in p16&0x00f0 and errorcodes in p64&0xffff0000 + .
[INFO]  from BOARD 10.1.3.11 (└øò÷Á☺) @ 2545s 264m 348u: CAN discovery has started for 1 eobrd_foc boards on (can1map, can2map) = (0x0002, 0x0000) with target can protocol ver 1.6 and application ver 5.2.220.
[INFO]  from BOARD 10.1.3.11 (└øò÷Á☺) @ 2545s 264m 737u: CAN discovery has detected a eobrd_foc board in CAN1 addr 1 with can protocol ver 1.6 and application ver 5.2.220 Search time was 0 ms
[INFO]  from BOARD 10.1.3.11 (└øò÷Á☺) @ 2545s 264m 897u: CAN discovery is OK for 1 eobrd_foc boards with target can protocol ver 1.6 and application ver 5.2.220. Search time was 0 ms
[DEBUG] embObjMotionControl:serviceVerifyActivate OK!
[DEBUG]  from BOARD 10.1.3.11 (└øò÷Á☺), src LOCAL, adr 0, time 2545s 265m 81u: (code 0x0500000d, par16 0x0000 par64 0x0000000000000000) -> CFG: EOtheMotionController can correctly configure 2foc-based motion. more info will follow + .
[DEBUG]  from BOARD 10.1.3.11 (└øò÷Á☺), src LOCAL, adr 0, time 2545s 301m 394u: (code 0x04000001, par16 0x000f par64 0x0000010000000040) -> DEBUG: tag01 + CURRENT PID
[DEBUG]  from BOARD 10.1.3.11 (└øò÷Á☺), src LOCAL, adr 0, time 2545s 301m 506u: (code 0x04000001, par16 0x000f par64 0x0000018000000200) -> DEBUG: tag01 + VELOCITY PID
[INFO] |yarp.dev.PolyDriver| Created device <embObjMotionControl>. See C++ class yarp::dev::embObjMotionControl for documentation.
[ERROR] |yarp.devices.controlboardwrapper2| Parameter networks use deprecated syntax
[INFO] |yarp.devices.controlboardwrapper2| /single-ETH-2FOC-motor/knee_one : no ROS initialization required
[INFO] |yarp.devices.controlboardwrapper2| /single-ETH-2FOC-motor/knee_one  initting YARP initialization
[INFO] |yarp.os.Port| Port /single-ETH-2FOC-motor/knee_one/rpc:i active at tcp://10.1.3.104:10003/
[INFO] |yarp.os.Port| Port /single-ETH-2FOC-motor/knee_one/command:i active at tcp://10.1.3.104:10004/
[INFO] |yarp.os.Port| Port /single-ETH-2FOC-motor/knee_one/state:o active at tcp://10.1.3.104:10005/
[INFO] |yarp.os.Port| Port /single-ETH-2FOC-motor/knee_one/stateExt:o active at tcp://10.1.3.104:10006/
[INFO] |yarp.dev.PolyDriver| Created wrapper <controlboardwrapper2>. See C++ class ControlBoardWrapper for documentation.
[INFO] |yarp.dev.PolyDriver| Created device <parametricCalibratorEth>. See C++ class yarp::dev::parametricCalibratorEth for documentation.
[INFO] Entering action level 5 of phase startup
[INFO] knee-one-mc_wrapper is not an IWrapper. Trying IMultipleWrapper
[INFO] All actions for action level 5 of startup phase started. Waiting for unfinished actions.
[INFO] All actions for action level 5 of startup phase finished.
[INFO] Entering action level 10 of phase startup
[DEBUG] knee-one-calibrator starting calibration of device knee-one-mc_wrapper
[INFO] All actions for action level 10 of startup phase started. Waiting for unfinished actions.
[INFO] Knee_one_Calibrator : starting calibration
[DEBUG] Knee_one_Calibrator : Joints calibration order:
[DEBUG] Knee_one_Calibrator : Calling calibrateJoint on joint  0 : type  9  with params:  2000 0 0 0 0
[DEBUG] Knee_one_Calibrator : set 1 j 0 : Calibrating... enc values AFTER calib:  -2782.45
[ERROR] Knee_one_Calibrator : Timeout while calibrating  0
[ERROR] Knee_one_Calibrator : set 1 : Calibration went wrong! Disabling axes and keeping safe pid limit
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 2 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 3 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 4 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 5 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 6 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 7 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 8 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 9 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 10 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 11 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 12 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 13 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 14 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 15 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 16 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 17 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[ERROR] A 0.250000 sec timeout occured in embObjMotionControl::checkRemoteControlModeStatus(), BOARD knee-eb10-j1 IP 10.1.3.11, joint 0, current mode: cal, requested: idl
[ERROR] failure of embObjMotionControl::checkRemoteControlModeStatus(j=0, targetmode=idl) for BOARD knee-eb10-j1 IP 10.1.3.11 after 17 attempts and 0.261755 seconds
[ERROR] In embObjMotionControl::setControlModeRaw(j= 0 , mode= idl ) for  BOARD knee-eb10-j1 (IP 10.1.3.11)   has failed checkRemoteControlModeStatus()
[DEBUG] knee-one-calibrator finished calibration of device knee-one-mc_wrapper
[INFO] All actions for action level 10 of startup phase finished.
[INFO] startup phase finished.
[INFO] run phase starting...
[DEBUG] yarprobotinterface running happily

The video of our test:

20210524_170145.mp4

@ale-git
Copy link

ale-git commented May 31, 2021

Hi @wevmacedo, I think that the 2FOC isn't able to detect the hard stop because it is made by hand, and thus not stable enough.
I'll try to implement some smarter stop detection.

@ale-git
Copy link

ale-git commented Jun 15, 2021

Hi @wevmacedo, I've noticed that the encoder value after a calibration with positive PWM is negative, so probably you have to invert the encoder sign. You can do it here:

by changing 2048 to -2048. Can you try this, please?

@wevmacedo
Copy link
Collaborator

Hi @ale-git,

We changed the encoder value like you said, but we continue with the same results mentioned above.

The output from the yarprobotinterface is as follows:

[DEBUG] Reading file C:\robotology\eth-boards-setups\single-ETH-ems4-1-motor-test-vislab\.\test_knee_joint_V25.xml
[DEBUG] yarprobotinterface: using xml parser for DTD v3.x
[DEBUG] Reading file C:\robotology\eth-boards-setups\single-ETH-ems4-1-motor-test-vislab\.\test_knee_joint_V25.xml
[DEBUG] Preprocessor complete in:  0.0075272 s
[INFO] |yarp.os.Port| Port /icub/yarprobotinterface active at tcp://10.1.3.104:10006/
[INFO] startup phase starting...
[DEBUG] eth::parser::print(pc104Data) for PC104:
[DEBUG] PC104/PC104IpAddress:PC104IpPort =  10.1.3.104:12345
[DEBUG] PC104/PC104TXrate =  1
[DEBUG] PC104/PC104RXrate =  5
[DEBUG] EthSender is a PeriodicThread with txrate = 1 ms
[DEBUG] EthReceiver is a PeriodicThread with rxrate = 5 ms
[WARNING] in EthReceiver::config() the config socket has queue size =  1048576 ; you request ETHRECEIVER_BUFFER_SIZE=
[DEBUG] eth::parser::print(boardData) for BOARD knee-eb10-j1
[DEBUG] ETH_BOARD/ETH_BOARD_PROPERTIES:
[DEBUG] ETH_BOARD/ETH_BOARD_PROPERTIES/IpAddress =  10.1.3.11
[DEBUG] ETH_BOARD/ETH_BOARD_PROPERTIES/IpPort =  12345
[DEBUG] ETH_BOARD/ETH_BOARD_PROPERTIES/Type =  ems4
[DEBUG] ETH_BOARD/ETH_BOARD_PROPERTIES/maxSizeRXpacket =  768
[DEBUG] ETH_BOARD/ETH_BOARD_PROPERTIES/maxSizeROP =  384
[DEBUG] ETH_BOARD/ETH_BOARD_SETTINGS:
[DEBUG] ETH_BOARD/ETH_BOARD_SETTINGS/Name =  knee-eb10-j1
[DEBUG] ETH_BOARD/ETH_BOARD_SETTINGS/RUNNINGMODE/(period, maxTimeOfRXactivity, maxTimeOfDOactivity, maxTimeOfTXactivity, TXrateOfRegularROPs) =  1000 400 300 300 5
[DEBUG] ETH_BOARD/ETH_BOARD_ACTIONS/MONITOR_ITS_PRESENCE
[DEBUG] ETH_BOARD/ETH_BOARD_ACTIONS/MONITOR_ITS_PRESENCE/(enabled, timeout, periodOfMissingReport) =  true 0.02 60
[DEBUG] eth::EthMonitorPresence::config(): monitoring of presence is ON for BOARD 10.1.3.11 (knee-eb10-j1) with timeout = 0.02 sec and period of missing report = 60 sec
[DEBUG] TheEthManager::requestResource2(): has just succesfully created a new EthResource for board of type ems4 with IP =  10.1.3.11
[WARNING] embObjMC BOARD  knee-eb10-j1 Missing OTHER_CONTROL_PARAMETERS.DeadZone parameter. I'll use default value. (see documentation for more datails)
[DEBUG] embObjMC BOARD  knee-eb10-j1 :fromConfig() detected that IMPEDANCE parameters section is found
[INFO] embObjMC BOARD  knee-eb10-j1 IMPEDANCE section: parameters successfully loaded
[WARNING] AutoCalibration parameter not found for board knee-eb10-j1 in bottle "2FOC" (Autocalibration 0) (Verbose 1) (HasHallSensor 0) (HasTempSensor 0) (HasRotorEncoder 1) (HasRotorEncoderIndex 0) (HasSpeedEncoder 0) (RotorIndexOffset 0) (MotorPoles 2)
[WARNING] In  knee-eb10-j1  there isn't 2FOC.AutoCalibration filed. For default it is disabled
[INFO]  from BOARD 10.1.3.11 (É1§fw☻), src LOCAL, adr 0, time 1866s 187m 873u: (code 0x00000034, par16 0x0001 par64 0x00000000000003dd) -> SYS: the board has detected a restart of the remote transceiver because the rx ropframe sequence number is 1. In par64 there is the expected number. + .
[DEBUG] EthResource::verifyBoardPresence() found BOARD knee-eb10-j1 with IP 10.1.3.11 after 0.0040585 seconds
[DEBUG] EthResource::verifyBoardTransceiver() has validated the transceiver of BOARD knee-eb10-j1 with IP 10.1.3.11
[DEBUG] EthResource::cleanBoardBehaviour() has cleaned the application in BOARD knee-eb10-j1 with IP 10.1.3.11 : config mode + cleared all its regulars
[DEBUG] EthResource::setTimingOfRunningCycle() for BOARD knee-eb10-j1 with IP 10.1.3.11 has succesfully set: cycletime = 1000 usec, RX DO TX = ( 400 300 300 ) usec and TX rate = 5  every cycle
[INFO] EthResource::askBoardVersion() found BOARD knee-eb10-j1 @ IP 10.1.3.11 of type ems4 with FW = ver 3.39 built on 2021 Apr 26 14:11
[DEBUG]  from BOARD 10.1.3.11 (É1§fw☻), src LOCAL, adr 0, time 1866s 234m 183u: (code 0x05000015, par16 0x1000 par64 0x00000000000f000f) -> CFG: EOtheEncoderReader can be correctly configured. p16&0xf000: number of joint; primary encs: failure mask in p16&0x000f and errorcodes in p64&0x0000ffff; secondary encs: failure mask in p16&0x00f0 and errorcodes in p64&0xffff0000 + .
[INFO]  from BOARD 10.1.3.11 (É1§fw☻) @ 1866s 234m 349u: CAN discovery has started for 1 eobrd_foc boards on (can1map, can2map) = (0x0002, 0x0000) with target can protocol ver 1.6 and application ver 5.2.220.
[INFO]  from BOARD 10.1.3.11 (É1§fw☻) @ 1866s 234m 737u: CAN discovery has detected a eobrd_foc board in CAN1 addr 1 with can protocol ver 1.6 and application ver 5.2.220 Search time was 0 ms
[INFO]  from BOARD 10.1.3.11 (É1§fw☻) @ 1866s 234m 897u: CAN discovery is OK for 1 eobrd_foc boards with target can protocol ver 1.6 and application ver 5.2.220. Search time was 0 ms
[DEBUG] embObjMotionControl:serviceVerifyActivate OK!
[DEBUG]  from BOARD 10.1.3.11 (É1§fw☻), src LOCAL, adr 0, time 1866s 235m 83u: (code 0x0500000d, par16 0x0000 par64 0x0000000000000000) -> CFG: EOtheMotionController can correctly configure 2foc-based motion. more info will follow + .
[DEBUG]  from BOARD 10.1.3.11 (É1§fw☻), src LOCAL, adr 0, time 1866s 274m 496u: (code 0x04000001, par16 0x000f par64 0x0000010000000040) -> DEBUG: tag01 + CURRENT PID
[DEBUG]  from BOARD 10.1.3.11 (É1§fw☻), src LOCAL, adr 0, time 1866s 274m 609u: (code 0x04000001, par16 0x000f par64 0x0000018000000200) -> DEBUG: tag01 + VELOCITY PID
[INFO] |yarp.dev.PolyDriver| Created device <embObjMotionControl>. See C++ class yarp::dev::embObjMotionControl for documentation.
[ERROR] |yarp.devices.controlboardwrapper2| Parameter networks use deprecated syntax
[INFO] |yarp.devices.controlboardwrapper2| /single-ETH-2FOC-motor/knee_one : no ROS initialization required
[INFO] |yarp.devices.controlboardwrapper2| /single-ETH-2FOC-motor/knee_one  initting YARP initialization
[INFO] |yarp.os.Port| Port /single-ETH-2FOC-motor/knee_one/rpc:i active at tcp://10.1.3.104:10007/
[INFO] |yarp.os.Port| Port /single-ETH-2FOC-motor/knee_one/command:i active at tcp://10.1.3.104:10008/
[INFO] |yarp.os.Port| Port /single-ETH-2FOC-motor/knee_one/state:o active at tcp://10.1.3.104:10009/
[INFO] |yarp.os.Port| Port /single-ETH-2FOC-motor/knee_one/stateExt:o active at tcp://10.1.3.104:10010/
[INFO] |yarp.dev.PolyDriver| Created wrapper <controlboardwrapper2>. See C++ class ControlBoardWrapper for documentation.
[INFO] |yarp.dev.PolyDriver| Created device <parametricCalibratorEth>. See C++ class yarp::dev::parametricCalibratorEth for documentation.
[INFO] Entering action level 5 of phase startup
[INFO] knee-one-mc_wrapper is not an IWrapper. Trying IMultipleWrapper
[INFO] All actions for action level 5 of startup phase started. Waiting for unfinished actions.
[INFO] All actions for action level 5 of startup phase finished.
[INFO] Entering action level 10 of phase startup
[DEBUG] knee-one-calibrator starting calibration of device knee-one-mc_wrapper
[INFO] All actions for action level 10 of startup phase started. Waiting for unfinished actions.
[INFO] Knee_one_Calibrator : starting calibration
[DEBUG] Knee_one_Calibrator : Joints calibration order:
[DEBUG] Knee_one_Calibrator : Calling calibrateJoint on joint  0 : type  9  with params:  2000 0 0 0 0
[DEBUG] Knee_one_Calibrator : set 1 j 0 : Calibrating... enc values AFTER calib:  -981.241
[ERROR] Knee_one_Calibrator : Timeout while calibrating  0
[ERROR] Knee_one_Calibrator : set 1 : Calibration went wrong! Disabling axes and keeping safe pid limit
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 2 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 3 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 4 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 5 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 6 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 7 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 8 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 9 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 10 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 11 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 12 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 13 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 14 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 15 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 16 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[WARNING] embObjMotionControl::checkRemoteControlModeStatus() has done 17 attempts and will retry again after a 0.010000 sec delay. (BOARD knee-eb10-j1 IP 10.1.3.11, joint 0) -> current mode = cal, requested = idl
[ERROR] A 0.250000 sec timeout occured in embObjMotionControl::checkRemoteControlModeStatus(), BOARD knee-eb10-j1 IP 10.1.3.11, joint 0, current mode: cal, requested: idl
[ERROR] failure of embObjMotionControl::checkRemoteControlModeStatus(j=0, targetmode=idl) for BOARD knee-eb10-j1 IP 10.1.3.11 after 17 attempts and 0.257983 seconds
[ERROR] In embObjMotionControl::setControlModeRaw(j= 0 , mode= idl ) for  BOARD knee-eb10-j1 (IP 10.1.3.11)   has failed checkRemoteControlModeStatus()
[DEBUG] knee-one-calibrator finished calibration of device knee-one-mc_wrapper
[INFO] All actions for action level 10 of startup phase finished.
[INFO] startup phase finished.
[INFO] run phase starting...
[DEBUG] yarprobotinterface running happily```



@ale-git
Copy link

ale-git commented Jul 5, 2021

Hi @wevmacedo, I've improved the hard stop detection in the 2FOC DC control. I've realized also that the 2FOC encoder management may have problems with multiple revolutions, so please be patient for a little while I'm going to fix it.
Cheers,
Alessandro

@ale-git
Copy link

ale-git commented Jul 7, 2021

Hi @wevmacedo, here it is the 2FOC firmware with rotational encoder support.
If it calibrates but isn't properly controllable, please try to change the encoder resolution sign again as explained here:
#15 (comment)
2FOC-DC.X.production.zip

@plinioMoreno
Copy link
Member Author

Hi @ale-git,

We uploaded the firmware from the previous message and got the following error:

[WARNING]  from BOARD 10.1.3.11 () @ 72s 390m 314u: CAN discovery has detected a eobrd_foc board in CAN1 addr 1 with can protocol ver 1.6 and application ver 5.3.220 Search time was 0 ms
[ERROR]  from BOARD 10.1.3.11 () @ 72s 390m 473u: CAN discovery has detected 1 invalid eobrd_foc boards in CAN1:
[ERROR] 1 of 1: wrong eobrd_foc BOARD 10.1.3.11:CAN1:1 because it has:  WRONG APPLICATION VERSION

Do we have to update all the repositories again?

cc @wevmacedo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants