공부/SPACE

cFS 설치 및 실행하는방법

JUNFUTURE 2024. 4. 22. 00:26

Part1 - Setup

아래 깃허브 링크에서 cFS를 git clone 해준다.

https://github.com/nasa/cFS

 

GitHub - nasa/cFS: The Core Flight System (cFS)

The Core Flight System (cFS). Contribute to nasa/cFS development by creating an account on GitHub.

github.com

git clone https://github.com/nasa/cFS.git
cd cFS

# submodule 설치
git checkout bootes-rc2
git submodule init
git submodule update

 

이때 submodule update를 해주면 아래와 같이 뜨며
cFS/apps/*

cFS/tools/*

에 있는 폴더들이 채워진다.

 

 

default makefile 과 definitions 를 복사해주자 :

# cFS 경로에서
cp cfe/cmake/Makefile.sample Makefile
cp -r cfe/cmake/sample_defs sample_defs

이렇게 되면 된다.

 

리눅스 standard 빌드에서 일반 유저로 실습중이라면
OSAL의 “permissive mode” 를 키면 메세지 큐 깊이와 우선순위에 좋다고 한다.

OSAL_CONFIG_DEBUG_PERMISSIVE_MODE FALSE -> TRUE로

Part2 - Build and Run

cmake를 이용해서 cFS Framework를 실행 및 빌드할 수 있음

make prep
make
make install
cd build/exe/cpu1/
./core-cpu1

 

startup 메시지랑 CFE_ES_Main 이 OPERATIONAL state에 돌입하는 것을 확인할 수 있다.
startup script랑 shared objects 경로로 인해서 ./core-cpu1 (cFS 시작 스크립트)은
반드시 build/exe/cpu1 디렉터리에서 실행해야된다.

 

 

 

Exercise 2 - Command cFE Executive Service

Part 1 – Start the Ground System

cFS-GroundSystem tool을 이용해서 commands를 보내거나 telemetry를 받을 수 있다.

(see https://github.com/nasa/cFS-GroundSystem/tree/master/Guide-GroundSystem.txt, the Guide-GroundSystem.txt).

 

PyQt5랑 PyZMQ를 다운받아줘야한다.

pip install PyQt5
pip install PyZMQ

 

트러블 슈팅

PyQt5 설치시 오류발생

 

pip install PyZMQ
Collecting PyQt5
  Using cached PyQt5-5.15.11.tar.gz (3.2 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 /tmp/tmp5e8t3fmk prepare_metadata_for_build_wheel /tmp/tmpbed42xl2
         cwd: /tmp/pip-install-kw4fuuzn/PyQt5
    Complete output (31 lines):
    Traceback (most recent call last):
      File "/tmp/tmp5e8t3fmk", line 126, in prepare_metadata_for_build_wheel
        hook = backend.prepare_metadata_for_build_wheel
    AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/tmp/tmp5e8t3fmk", line 280, in <module>
        main()
      File "/tmp/tmp5e8t3fmk", line 263, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
      File "/tmp/tmp5e8t3fmk", line 130, in prepare_metadata_for_build_wheel
        return _get_wheel_metadata_from_wheel(backend, metadata_directory,
      File "/tmp/tmp5e8t3fmk", line 159, in _get_wheel_metadata_from_wheel
        whl_basename = backend.build_wheel(metadata_directory, config_settings)
      File "/tmp/pip-build-env-rtvzcbs4/overlay/lib/python3.8/site-packages/sipbuild/api.py", line 28, in build_wheel
        project = AbstractProject.bootstrap('wheel',
      File "/tmp/pip-build-env-rtvzcbs4/overlay/lib/python3.8/site-packages/sipbuild/abstract_project.py", line 74, in bootstrap
        project.setup(pyproject, tool, tool_description)
      File "/tmp/pip-build-env-rtvzcbs4/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 608, in setup
        self.apply_user_defaults(tool)
      File "/tmp/pip-install-kw4fuuzn/PyQt5/project.py", line 68, in apply_user_defaults
        super().apply_user_defaults(tool)
      File "/tmp/pip-build-env-rtvzcbs4/overlay/lib/python3.8/site-packages/pyqtbuild/project.py", line 51, in apply_user_defaults
        super().apply_user_defaults(tool)
      File "/tmp/pip-build-env-rtvzcbs4/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 237, in apply_user_defaults
        self.builder.apply_user_defaults(tool)
      File "/tmp/pip-build-env-rtvzcbs4/overlay/lib/python3.8/site-packages/pyqtbuild/builder.py", line 50, in apply_user_defaults
        raise PyProjectOptionException('qmake',
    sipbuild.pyproject.PyProjectOptionException
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 /tmp/tmp5e8t3fmk prepare_metadata_for_build_wheel /tmp/tmpbed42xl2 Check the logs for full command output.

 

pip install --upgrade pip setuptools wheel

 

sudo apt-get install --reinstall libxcb-xinerama0
sudo apt-get install libxcb-xinerama0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxcb-sync1 libxcb-xfixes0

 

 

이후 GroundSystem을 실행해주자.

cd ~/cFS/tools/cFS-GroundSystem/Subsystems/cmdUtil
make
cd ../..
python3 GroundSystem.py

 

이후 다음과 같이 Sample_App에 No-op 커맨드를 전송해볼 수 있다.