Skip to content

Commit

Permalink
Enable compilation of amcbldc V2
Browse files Browse the repository at this point in the history
  • Loading branch information
mfussi66 committed Feb 28, 2024
1 parent 5c1d78a commit b0cc008
Show file tree
Hide file tree
Showing 62 changed files with 5,179 additions and 6,197 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1352,7 +1352,7 @@

<Group>
<GroupName>mbd</GroupName>
<tvExp>0</tvExp>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
Expand Down Expand Up @@ -1488,6 +1488,18 @@
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>18</GroupNumber>
<FileNumber>75</FileNumber>
<FileType>8</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\mbd\amcbldc\sharedutils\rt_hypotf.cpp</PathWithFileName>
<FilenameWithoutPath>rt_hypotf.cpp</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>

<Group>
Expand All @@ -1498,7 +1510,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>19</GroupNumber>
<FileNumber>75</FileNumber>
<FileNumber>76</FileNumber>
<FileType>8</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
Expand All @@ -1518,7 +1530,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>20</GroupNumber>
<FileNumber>76</FileNumber>
<FileNumber>77</FileNumber>
<FileType>8</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
Expand All @@ -1531,32 +1543,20 @@
</Group>

<Group>
<GroupName>mbd::supervisor-rx</GroupName>
<GroupName>mbd::supervisor</GroupName>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>21</GroupNumber>
<FileNumber>77</FileNumber>
<FileType>8</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\mbd\amcbldc\supervisor-rx\SupervisorFSM_RX.cpp</PathWithFileName>
<FilenameWithoutPath>SupervisorFSM_RX.cpp</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>21</GroupNumber>
<FileNumber>78</FileNumber>
<FileType>8</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\mbd\amcbldc\supervisor-rx\SupervisorFSM_RX_data.cpp</PathWithFileName>
<FilenameWithoutPath>SupervisorFSM_RX_data.cpp</FilenameWithoutPath>
<PathWithFileName>..\..\..\..\mbd\amcbldc\supervisor\supervisor.cpp</PathWithFileName>
<FilenameWithoutPath>supervisor.cpp</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
Expand Down Expand Up @@ -1632,18 +1632,6 @@
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>24</GroupNumber>
<FileNumber>83</FileNumber>
<FileType>8</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\mbd\amcbldc\control-foc\control_foc_data.cpp</PathWithFileName>
<FilenameWithoutPath>control_foc_data.cpp</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>

<Group>
Expand All @@ -1654,7 +1642,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>25</GroupNumber>
<FileNumber>84</FileNumber>
<FileNumber>83</FileNumber>
<FileType>8</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
Expand All @@ -1674,7 +1662,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>26</GroupNumber>
<FileNumber>85</FileNumber>
<FileNumber>84</FileNumber>
<FileType>8</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
Expand All @@ -1694,7 +1682,7 @@
<RteFlg>0</RteFlg>
<File>
<GroupNumber>27</GroupNumber>
<FileNumber>86</FileNumber>
<FileNumber>85</FileNumber>
<FileType>8</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
Expand All @@ -1706,6 +1694,38 @@
</File>
</Group>

<Group>
<GroupName>mbd::motion-controller</GroupName>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>28</GroupNumber>
<FileNumber>86</FileNumber>
<FileType>8</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\mbd\amcbldc\motion-controller\motion_controller.cpp</PathWithFileName>
<FilenameWithoutPath>motion_controller.cpp</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>28</GroupNumber>
<FileNumber>87</FileNumber>
<FileType>8</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\..\mbd\amcbldc\motion-controller-single\motion_controller_single.cpp</PathWithFileName>
<FilenameWithoutPath>motion_controller_single.cpp</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>

<Group>
<GroupName>::CMSIS</GroupName>
<tvExp>0</tvExp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@
<MiscControls>-Wno-pragma-pack -Wno-deprecated-register -DEMBOT_USE_rtos_osal -DEMBOT_AMCBLDC_APP05</MiscControls>
<Define>USE_STM32HAL STM32HAL_BOARD_AMCBLDC STM32HAL_DRIVER_V122</Define>
<Undefine></Undefine>
<IncludePath>..\..\bsp;..\..\..\..\libs\highlevel\abslayer\osal\api;..\..\..\..\libs\midware\eventviewer\api;..\..\..\..\libs\lowlevel\stm32hal\api;..\..\..\..\embot\app;..\..\..\..\embot\i2h;..\..\..\..\embot\hw;..\..\..\..\embot\os;..\..\..\..\embot;..\..\..\..\embot\app\dsp;..\..\..\..\embot\app\skeleton;..\..\..\..\embot\prot\can;..\..\..\..\..\..\..\..\icub-firmware-shared\can\canProtocolLib;..\..\..\..\..\..\..\..\icub-firmware-shared\embot\core;..\..\..\..\..\..\..\..\icub-firmware-shared\embot\tools;..\..\..\..\libs\lowlevel\cmsis\dsp\v160\Include;..\..\..\..\libs\highlevel\abslayer\hal2\api;..\src\motorhal2;..\..\..\..\mbd\amcbldc\sharedutils;..\..\..\..\mbd\amcbldc\can-decoder;..\..\..\..\mbd\amcbldc\can-raw2struct;..\..\..\..\mbd\amcbldc\supervisor-rx;..\..\..\..\mbd\amcbldc\supervisor-tx;..\..\..\..\mbd\amcbldc\can-encoder;..\..\..\..\mbd\amcbldc\control-outer;..\..\..\..\mbd\amcbldc\control-foc;..\..\..\..\mbd\amcbldc\estimator;..\..\..\..\mbd\amcbldc\amc-bldc;..\..\..\..\mbd\amcbldc\filter-current;..\..\..\..\embot\app\bldc;..\src\app-board-amcbldc</IncludePath>
<IncludePath>..\..\bsp;..\..\..\..\libs\highlevel\abslayer\osal\api;..\..\..\..\libs\midware\eventviewer\api;..\..\..\..\libs\lowlevel\stm32hal\api;..\..\..\..\embot\app;..\..\..\..\embot\i2h;..\..\..\..\embot\hw;..\..\..\..\embot\os;..\..\..\..\embot;..\..\..\..\embot\app\dsp;..\..\..\..\embot\app\skeleton;..\..\..\..\embot\prot\can;..\..\..\..\..\..\..\..\icub-firmware-shared\can\canProtocolLib;..\..\..\..\..\..\..\..\icub-firmware-shared\embot\core;..\..\..\..\..\..\..\..\icub-firmware-shared\embot\tools;..\..\..\..\libs\lowlevel\cmsis\dsp\v160\Include;..\..\..\..\libs\highlevel\abslayer\hal2\api;..\src\motorhal2;..\..\..\..\mbd\amcbldc\sharedutils;..\..\..\..\mbd\amcbldc\can-decoder;..\..\..\..\mbd\amcbldc\can-raw2struct;..\..\..\..\mbd\amcbldc\supervisor;..\..\..\..\mbd\amcbldc\supervisor-tx;..\..\..\..\mbd\amcbldc\can-encoder;..\..\..\..\mbd\amcbldc\control-outer;..\..\..\..\mbd\amcbldc\control-foc;..\..\..\..\mbd\amcbldc\estimator;..\..\..\..\mbd\amcbldc\amc-bldc;..\..\..\..\mbd\amcbldc\filter-current;..\..\..\..\mbd\amcbldc\motion-controller;..\..\..\..\mbd\amcbldc\motion-controller-single;..\..\..\..\embot\app\bldc;..\src\app-board-amcbldc</IncludePath>
</VariousControls>
</Cads>
<Aads>
Expand Down Expand Up @@ -1167,6 +1167,11 @@
<FileType>8</FileType>
<FilePath>..\..\..\..\mbd\amcbldc\sharedutils\uMultiWordShl.cpp</FilePath>
</File>
<File>
<FileName>rt_hypotf.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\..\..\mbd\amcbldc\sharedutils\rt_hypotf.cpp</FilePath>
</File>
</Files>
</Group>
<Group>
Expand All @@ -1190,17 +1195,12 @@
</Files>
</Group>
<Group>
<GroupName>mbd::supervisor-rx</GroupName>
<GroupName>mbd::supervisor</GroupName>
<Files>
<File>
<FileName>SupervisorFSM_RX.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\..\..\mbd\amcbldc\supervisor-rx\SupervisorFSM_RX.cpp</FilePath>
</File>
<File>
<FileName>SupervisorFSM_RX_data.cpp</FileName>
<FileName>supervisor.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\..\..\mbd\amcbldc\supervisor-rx\SupervisorFSM_RX_data.cpp</FilePath>
<FilePath>..\..\..\..\mbd\amcbldc\supervisor\supervisor.cpp</FilePath>
</File>
</Files>
</Group>
Expand Down Expand Up @@ -1306,11 +1306,6 @@
<FileType>8</FileType>
<FilePath>..\..\..\..\mbd\amcbldc\control-foc\FOCInnerLoop.cpp</FilePath>
</File>
<File>
<FileName>control_foc_data.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\..\..\mbd\amcbldc\control-foc\control_foc_data.cpp</FilePath>
</File>
</Files>
</Group>
<Group>
Expand Down Expand Up @@ -1343,6 +1338,21 @@
</File>
</Files>
</Group>
<Group>
<GroupName>mbd::motion-controller</GroupName>
<Files>
<File>
<FileName>motion_controller.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\..\..\mbd\amcbldc\motion-controller\motion_controller.cpp</FilePath>
</File>
<File>
<FileName>motion_controller_single.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\..\..\mbd\amcbldc\motion-controller-single\motion_controller_single.cpp</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>::CMSIS</GroupName>
<GroupOption>
Expand Down Expand Up @@ -2509,6 +2519,11 @@
<FileType>8</FileType>
<FilePath>..\..\..\..\mbd\amcbldc\sharedutils\uMultiWordShl.cpp</FilePath>
</File>
<File>
<FileName>rt_hypotf.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\..\..\mbd\amcbldc\sharedutils\rt_hypotf.cpp</FilePath>
</File>
</Files>
</Group>
<Group>
Expand All @@ -2532,17 +2547,12 @@
</Files>
</Group>
<Group>
<GroupName>mbd::supervisor-rx</GroupName>
<GroupName>mbd::supervisor</GroupName>
<Files>
<File>
<FileName>SupervisorFSM_RX.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\..\..\mbd\amcbldc\supervisor-rx\SupervisorFSM_RX.cpp</FilePath>
</File>
<File>
<FileName>SupervisorFSM_RX_data.cpp</FileName>
<FileName>supervisor.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\..\..\mbd\amcbldc\supervisor-rx\SupervisorFSM_RX_data.cpp</FilePath>
<FilePath>..\..\..\..\mbd\amcbldc\supervisor\supervisor.cpp</FilePath>
</File>
</Files>
</Group>
Expand Down Expand Up @@ -2579,11 +2589,6 @@
<FileType>8</FileType>
<FilePath>..\..\..\..\mbd\amcbldc\control-foc\FOCInnerLoop.cpp</FilePath>
</File>
<File>
<FileName>control_foc_data.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\..\..\mbd\amcbldc\control-foc\control_foc_data.cpp</FilePath>
</File>
</Files>
</Group>
<Group>
Expand Down Expand Up @@ -2616,6 +2621,21 @@
</File>
</Files>
</Group>
<Group>
<GroupName>mbd::motion-controller</GroupName>
<Files>
<File>
<FileName>motion_controller.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\..\..\mbd\amcbldc\motion-controller\motion_controller.cpp</FilePath>
</File>
<File>
<FileName>motion_controller_single.cpp</FileName>
<FileType>8</FileType>
<FilePath>..\..\..\..\mbd\amcbldc\motion-controller-single\motion_controller_single.cpp</FilePath>
</File>
</Files>
</Group>
<Group>
<GroupName>::CMSIS</GroupName>
<GroupOption>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ bool embot::app::board::amcbldc::theMBD::Impl::tick(const std::vector<embot::pro
}

// read Vcc
AMC_BLDC_U.SensorsData_p.supplyvoltagesensors.voltage = 44; // TODO: read the voltage from ADC (temporary hardcoded)
AMC_BLDC_U.SensorsData_p.driversensors.Vcc = 44; // TODO: read the voltage from ADC (temporary hardcoded)


// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -532,7 +532,7 @@ void embot::app::board::amcbldc::theMBD::Impl::onCurrents_FOC_innerloop(void *ow
electricalAngleOld = electricalAngle;

// calculate the current joint position
position = position + delta / AMC_BLDC_Y.ConfigurationParameters_p.motorconfig.pole_pairs;
position = position + delta / AMC_BLDC_Y.ConfigurationParameters.motor.pole_pairs;

AMC_BLDC_U.SensorsData_p.motorsensors.angle = static_cast<real32_T>(electricalAngle)*0.0054931640625f; // (60 interval angle)

Expand All @@ -549,13 +549,13 @@ void embot::app::board::amcbldc::theMBD::Impl::onCurrents_FOC_innerloop(void *ow

// -----------------------------------------------------------------------------

AMC_BLDC_U.SensorsData_p.jointpositions.position = static_cast<real32_T>(position) * 0.0054931640625f; // iCubDegree -> deg
AMC_BLDC_U.SensorsData_p.jointpositions = static_cast<real32_T>(position) * 0.0054931640625f; // iCubDegree -> deg

// Set the voltages

embot::hw::motor::PWMperc pwmperc
{
AMC_BLDC_Y.ControlOutputs_p.Vabc[0], AMC_BLDC_Y.ControlOutputs_p.Vabc[1], AMC_BLDC_Y.ControlOutputs_p.Vabc[2]
AMC_BLDC_Y.ControlOutputs.Vabc[0], AMC_BLDC_Y.ControlOutputs.Vabc[1], AMC_BLDC_Y.ControlOutputs.Vabc[2]
};
embot::hw::motor::setPWM(embot::hw::MOTOR::one, pwmperc);

Expand Down
Loading

0 comments on commit b0cc008

Please sign in to comment.