Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-24798

Put the Hexapod into Standby State after the clearError Command

    XMLWordPrintable

    Details

      Description

      Put the hexapod PXI into the standby state after clearing the error. This task will need to update the Simulink model for the state machine transition. After this, I will need to generate the C/C++ code and put back to ts_hexapod_controller and test the new built. This task will need to learn and test and hexapod simulink model. This task will also try to understand the logic of look-up table (LUT) in code.

        Attachments

        1. hexapod_pos.png
          hexapod_pos.png
          63 kB
        2. hexapod_tilt.png
          hexapod_tilt.png
          102 kB
        3. hexapodStateTransition.png
          hexapodStateTransition.png
          34 kB

          Issue Links

            Activity

            No builds found.
            ttsai Te-Wei Tsai created issue -
            ttsai Te-Wei Tsai made changes -
            Field Original Value New Value
            Epic Link DM-23800 [ 431613 ]
            ttsai Te-Wei Tsai made changes -
            Link This issue relates to DM-23848 [ DM-23848 ]
            ttsai Te-Wei Tsai made changes -
            Status To Do [ 10001 ] In Progress [ 3 ]
            Hide
            ttsai Te-Wei Tsai added a comment -

            I realized the hard-coded file path in "hexapod_LUT_source_final/" is different from the files in "ts_hexapod_controller/src/smlnkModel". The proof is in the following.

            Used the command of 'grep -nr "fileid = cfopen(" .' in ts_hexapod_controller repository and got the following:

            --------------------------------------------------------------------------------------------------------------------------

            ./src/smlnkModel/extract_Azimuth_Data.c:50: fileid = cfopen("//nfsdemo//Azimuth_Data.csv.M2", "rb");
            ./src/smlnkModel/extract_Azimuth_Data.c:51: else fileid = cfopen("//nfsdemo//Azimuth_Data.csv.CAM", "rb");
            ./src/smlnkModel/lut/generate_LUT.c:72: fileid = cfopen("//nfsdemo//Elevation_Data.csv.M2", "rb");
            ./src/smlnkModel/lut/generate_LUT.c:73: else fileid = cfopen("//nfsdemo//Elevation_Data.csv.CAM", "rb");
            ./src/smlnkModel/lut/generate_LUT.c:182: fileid = cfopen("//nfsdemo//Temperature_Data.csv.M2", "rb");
            ./src/smlnkModel/lut/generate_LUT.c:183: else fileid = cfopen("//nfsdemo//Temperature_Data.csv.CAM", "rb");

            --------------------------------------------------------------------------------------------------------------------------

            Show
            ttsai Te-Wei Tsai added a comment - I realized the hard-coded file path in "hexapod_LUT_source_final/" is different from the files in "ts_hexapod_controller/src/smlnkModel". The proof is in the following. Used the command of 'grep -nr "fileid = cfopen(" .' in ts_hexapod_controller repository and got the following: -------------------------------------------------------------------------------------------------------------------------- ./src/smlnkModel/extract_Azimuth_Data.c:50: fileid = cfopen("//nfsdemo//Azimuth_Data.csv.M2", "rb"); ./src/smlnkModel/extract_Azimuth_Data.c:51: else fileid = cfopen("//nfsdemo//Azimuth_Data.csv.CAM", "rb"); ./src/smlnkModel/lut/generate_LUT.c:72: fileid = cfopen("//nfsdemo//Elevation_Data.csv.M2", "rb"); ./src/smlnkModel/lut/generate_LUT.c:73: else fileid = cfopen("//nfsdemo//Elevation_Data.csv.CAM", "rb"); ./src/smlnkModel/lut/generate_LUT.c:182: fileid = cfopen("//nfsdemo//Temperature_Data.csv.M2", "rb"); ./src/smlnkModel/lut/generate_LUT.c:183: else fileid = cfopen("//nfsdemo//Temperature_Data.csv.CAM", "rb"); --------------------------------------------------------------------------------------------------------------------------
            Hide
            ttsai Te-Wei Tsai added a comment - - edited

            I realized the MATLAB Coder can not use the functions of setenv() and getenv(). It looks like the MOOG developer had the different version of LUT codes, especially for generate_LUT.c file.

            Rearrange the LUT codes in ts_hexapod_controller repo. Added the cpLutCntlr.sh file to copy the LUT files.

            It looks like the LUT code and hexapod controller simulink code are decoupled after reading the code of commanding.c in ts_hexapod_controller.

            Show
            ttsai Te-Wei Tsai added a comment - - edited I realized the MATLAB Coder can not use the functions of setenv() and getenv(). It looks like the MOOG developer had the different version of LUT codes, especially for generate_LUT.c file. Rearrange the LUT codes in ts_hexapod_controller repo. Added the cpLutCntlr.sh file to copy the LUT files. It looks like the LUT code and hexapod controller simulink code are decoupled after reading the code of commanding.c in ts_hexapod_controller.
            ttsai Te-Wei Tsai made changes -
            Description Put the hexapod PXI into the standby state after clearing the error. This task will need to update the Simulink model for the state machine transition. After this, I will need to generate the C/C++ code and put back to ts_hexapod_controller and test the new built. This task will need to learn and test and hexapod simulink model. Put the hexapod PXI into the standby state after clearing the error. This task will need to update the Simulink model for the state machine transition. After this, I will need to generate the C/C++ code and put back to ts_hexapod_controller and test the new built. This task will need to learn and test and hexapod simulink model. This task will also try to understand the logic of look-up table (LUT) in code.
            ttsai Te-Wei Tsai made changes -
            Attachment hexapodStateTransition.png [ 43961 ]
            Hide
            ttsai Te-Wei Tsai added a comment -

            Updated the state machine of hexapod controller to transit the Fault state to Standby state after clearing the error. The result is in the following:

            Show
            ttsai Te-Wei Tsai added a comment - Updated the state machine of hexapod controller to transit the Fault state to Standby state after clearing the error. The result is in the following:
            ttsai Te-Wei Tsai made changes -
            Attachment hexapod_pos.png [ 43967 ]
            Attachment hexapod_tilt.png [ 43968 ]
            Hide
            ttsai Te-Wei Tsai added a comment - - edited

            Move the hexapod position as the following:

            Show
            ttsai Te-Wei Tsai added a comment - - edited Move the hexapod position as the following:
            ttsai Te-Wei Tsai made changes -
            Attachment hexapod_pos.png [ 43967 ]
            ttsai Te-Wei Tsai made changes -
            Attachment hexapod_pos.png [ 43969 ]
            Show
            ttsai Te-Wei Tsai added a comment - The updated transition can follow: https://github.com/lsst-ts/ts_hexapod_controller/blob/tickets/DM-24798/src/smlnkModel/hexapod_smlnk_Controller.c#L6685-L6688
            Show
            ttsai Te-Wei Tsai added a comment - Please help to review the PRs: 1.  https://github.com/lsst-ts/ts_mt_hexRot_simulink/pull/4 2.  https://github.com/lsst-ts/ts_hexapod_controller/pull/3 The Jenkins test is here: https://tssw-ci.lsst.org/job/LSST_Telescope-and-Site/job/ts_hexapod_controller/job/tickets%252FDM-24798/10/ Thanks!
            ttsai Te-Wei Tsai made changes -
            Reviewers Russell Owen [ rowen ]
            Status In Progress [ 3 ] In Review [ 10004 ]
            Hide
            rowen Russell Owen added a comment -

            That one change you pointed out (two comments above, "the updated transition") looks fine and your tests are convincing. However, there are two pull requests (with many changed files). Please let me know if there is anything else you want reviewed besides that one snippet.

            Show
            rowen Russell Owen added a comment - That one change you pointed out (two comments above, "the updated transition") looks fine and your tests are convincing. However, there are two pull requests (with many changed files). Please let me know if there is anything else you want reviewed besides that one snippet.
            Hide
            ttsai Te-Wei Tsai added a comment -

            I think the snippet should be good enough at this moment. The main update is in the Simuilink model and it needs to have the Simulink installed to test. There are many files because they were generated by the Simulink model with machine code inside. In addition, the Simulink version I used is R2019a and it looks like MOOG used the R2017a before. Therefore, there should be some change how does the Simulink generate the C/C++ code. Thanks!

            Show
            ttsai Te-Wei Tsai added a comment - I think the snippet should be good enough at this moment. The main update is in the Simuilink model and it needs to have the Simulink installed to test. There are many files because they were generated by the Simulink model with machine code inside. In addition, the Simulink version I used is R2019a and it looks like MOOG used the R2017a before. Therefore, there should be some change how does the Simulink generate the C/C++ code. Thanks!
            Hide
            rowen Russell Owen added a comment -

            OK. Then I have marked the pull requests as reviewed (based on those few lines). Thank you for making this change.

            Show
            rowen Russell Owen added a comment - OK. Then I have marked the pull requests as reviewed (based on those few lines). Thank you for making this change.
            rowen Russell Owen made changes -
            Status In Review [ 10004 ] Reviewed [ 10101 ]
            ttsai Te-Wei Tsai made changes -
            Resolution Done [ 10000 ]
            Status Reviewed [ 10101 ] Done [ 10002 ]

              People

              Assignee:
              ttsai Te-Wei Tsai
              Reporter:
              ttsai Te-Wei Tsai
              Reviewers:
              Russell Owen
              Watchers:
              Russell Owen, Te-Wei Tsai
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Start date:
                End date:

                  Jenkins

                  No builds found.