Skip to content
jaxa edited this page Nov 30, 2020 · 4 revisions

ROS/cFE Project operation manual

Revision history

Revision date of issue Contents
1.0 7/7/2020 First edition
1.1 11/25/2020 Added examples, ROS-melodic support

Table of Contents

[[TOC]]

1. General rules

1.1. Purpose

Core Flight Executive (cFE) is a framework implementation of spacecraft software provided by NASA. This document describes the procedure for arranging the ROS/cFE conversion module, the porting ROS nodes, ROS-side relay node, and cFE-side relay application created by the CFS converter, and the procedure for changing the settings for creating and executing them.

1.2. Scope of application

This document applies to the creation procedure and modification procedure of configuration file, for the following components,

  • ROS/cFE conversion module,
  • porting ROS nodes,
  • ROS-side relay node,
  • cFE-side relay application.

1.3. Term definition

Table 1-1 shows definitions and explanations of terms used in this document.

Table 1-1 Term definition
Term Description
cFE Core Flight Executive
CFS Core Flight System
SB SoftwareBus of cFE core tasks
ROS Robot Operating System
EVS Event Service of cFE core tasks

1.4. Related document

1.4.1. Compliant document

The following documents conform to this document.

  • cFE Application Developers Guide.doc: cFE developer documentation

1.5. Document Structure

The structure of this document is as follows.

  1. General rules
  2. ROS application development environment for cFE
  3. Creation procedure
  4. Modification procedure
  5. Building procedure

"2. ROS application development environment for cFE" shows the ROS and cFE development environment.
"3. Creation Procedure" shows the procedure for arranging the ROS/cFE conversion module and the porting ROS nodes, ROS-side relay node, and cFE-side relay application.
"4. Modification procedure" shows the modification procedure of the configuration file required to execute the ported ROS nodes.
"5. Building procedure" shows the building and execution procedure of the porting ROS nodes, ROS-side relay node, and cFE-side relay application.

2. ROS application development environment for cFE

2.1. Operating environment

The operating environment of ROS and cFE is shown in this chapter.

2.1.1. Ubuntu

The building procedure described in this document requires the environment where Ubuntu 16.04 LTS is installed.
The required libraries are shown below.

  • gcc-multilib
  • g ++-multilib
  • build-essential
  • libc-dev-i386
  • libstdc ++ 6-4.7-dev: i386

2.1.2. ROS

ROS kinetic or melodic is required.

2.1.3. CFE

2.1.3.1. OSAL

Version 4.2.1 is used for OSAL. OSAL can be downloaded from the following URL.
https://sourceforge.net/projects/osal/files/osal-4.2.1a-release.tar.gz/download

2.1.3.2. CFE application

Version 6.5.0 of the cFE source code is used. cFE source code can be downloaded from the following URL.
https://sourceforge.net/projects/coreflightexec/files/cFE-6.5.0/

2.1.4. Development Language

The development language is C++.

2.2. Environment construction

2.2.1. ROS environment construction procedure

2.2.1.1. ROS kinetic

The procedure for installing ROS kinetic is shown below. Reference URL: http://wiki.ros.org/kinetic/Installation/Ubuntu

Execute the following command.

# sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
# sudo apt-key adv --keyserver 'hkp://ha.pool.sks-keyservers.net:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
# sudo apt update
# sudo apt install ros-kinetic-desktop-full

Execute the following command to configure ROS.

# echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
# source ~/.bashrc

Execute the following command to perform rosinstall order.

# sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
# sudo apt-get install python-rosinstall
# sudo rosdep init
# rosdep update
2.2.1.2. ROS melodic

The procedure for installing ROS melodic is shown below. Reference URL: http://wiki.ros.org/melodic/Installation/Ubuntu

Execute the following command.

# sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
# sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
# sudo apt update
# sudo apt install ros-melodic-desktop-full

Execute the following command to configure ROS.

# echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
# source ~/.bashrc

Execute the following command to perform rosinstall order.

# sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
# sudo apt install python-rosdep
# sudo rosdep init
# rosdep update

2.2.2. CFE environment construction procedure

Download the OSAL and cFE source code from the URL shown in Chapter 2.1.3.1 and 2.1.3.2, and execute the following commands.

# tar -zxf cFE-6.5.0-OSS-release.tar.gz
# tar -zxf osal-4.2.1-release.tar.gz
# mv osal-4.2.1-release cFE-6.5.0-OSS-release/osal

3. Creation procedure

3.1. ROS/cFE conversion module

Figure 3-1 shows the directory structure

Extract the cFE source code including the distributed conversion module. Figure 3-1 shows the directory structure when expanded.

manu-fig3-1

Fig. 3-1 CFE source code directory structure including conversion module

3.2. Source code conversion procedure

Expand the distributed CFS converter. The file structure when expanded is shown below. It should be noted that although there are other files besides those shown below, the files need not be changed or executed on the user side, and thus will be omitted.

manu-fig3-2

Fig. 3-2 CFS converter file structure

The procedure for creating a ported ROS node, ROS-side relay node, and cFE-side relay application using a CFS converter is shown below.

  1. Go to the "CFS converter" directory in Figure 32

  2. Edit config.ini

    • cfe_path: Specify the absolute path of cFE source code / apps
    • ros_path: Specify the absolute path of catkin_ws / src of ROS
    • create_relay_flag: Specify 1 when performing ROS/cFE network bridge, and specify 0 when not.
  3. Edit convert_list.txt and enter one of the following

    • [absolute path of ROS node]
    • [absolute path of ROS node] [launch file name] [launch node name]
      ※ [Launch file name] is the name of the launch file (including extension) included directly under the launch directory in the absolute path of the ROS node
      ※※ [launch node name] is the value of the name attribute of the node tag described in [launch file name]
  4. If the name of the ROS node is more than 13 characters, edit main_func_name.yaml. Enter the absolute path of the ROS node in the key name and the main function name in the value

  5. Edit Connect.launch when performing ROS/cFE network bridge

    • ros_relay_node
      • protocol: Set tcp or udp
      • port: Specifies the port number when receiving data from the cFE
      • port_send: Specifies the port number when sending data to the cFE
      • ip_addr: Specify the IP address of the PC that runs the cFE-side relay application
      • ring_length: Specify the ring buffer length of the received data
    • cfe_relay_app
      • port: Specify the port number when receiving data from ROS
      • port_send: Specifies the port number when sending data to the ROS-side
      • ip_addr: Specify the IP address of the PC that executes the ROS-side relay node
      • ring_length: Specify the ring buffer length of the received data
  6. Edit MsgId2Topic.launch when linking with an existing cFE application by performing ROS/cFE network bridge

    • topic: Specify the topic name to publish / subscribe on the ROS-side relay node
    • ros_data_type: Specifies the data type of the message on the ROS-side Msg msg_id: Specify the message ID to publish / subscribe on the cFE relay application
    • cfe_data_type: Specifies the data type of the message on the cFE-side
    • sender: Specify 0 when sending data from the ROS to the cFE, and specify 1 when sending data from the cFE to the ROS.
  7. Grant execution permission to start_cfs_converter.sh and execute

    • The cFE relay application and the ported ROS node are created directly under the path specified in cfe_path
    • ROS-side relay node is created directly under the path specified in ros_path

When the CFS converter is used, the directory of the ROS node to be converted is shown in red frame below. The directory inside the red frame is searched recursively, and all files are converted. All the converted files are stored under the "src" directory in Fig 3-3.

manu-fig3-3

Fig. 3-3 ROS node conversion target

4. Change procedure

4.1. Makefile

Change the following about the Makefile of the ported ROS node.

  • OBJS
    Describe the o files and so files required to create the so file, separated by a space. If you are using a library such as an additional runtime library for c ++, include the path to the corresponding library.
    Example)
     [o file path] /usr/lib/i386-linux-gnu/libstdc++.so.6
    
  • .Cpp.o
    Describe the command of the cpp file to be compiled.
    Example)
    $ (COMPILER) $ (LOCAL_COPTS) -std = c ++ 11 -m32 -Wall $ (INCLUDE_PATH) -g -O0 -DOS_DEBUG_LEVEL = $ (DEBUG_LEVEL) -c -o [o file name] [cpp file path]
    

4.2. CFE Makefile

Modify the file in the following path to build the ported ROS node.

[cFE source code] / build / cpu1 / Makefile

The following shows the contents of changes in the Makefile.

  • THE_APPS
    Describe the directory name of the ported ROS node located in apps. Example)
THE_APPS + = [ported ROS node directory name]

4.3. Cfe_es_startup.scr

Change the file in the following path to configure the ported ROS node that is started when cFE is executed.

[cFE source code] /build/cpu1/exe/cfe_es_startup.scr

An example of the change is shown in Figure 4-1. Below is an example of adding a ROS/cFE conversion module.

manu-fig4-1

Fig. 4-1 Example of changing cfe_es_startup.scr

The settings of the cFE relay application are as follows. Add the following to the end of the above porting ROS node settings. The priority is changed to the largest value.

CFE_APP, /cf/apps/relay_app.so, RELAY_AppMain,RELAY_APP, 30, 0, 0x0, 0;

4.3.1. Notes

If the number of characters exceeds the default limit when editing cfe_es_startup.scr, modify the relevant part of the file as follows.
② When the directory name of the ported ROS node exceeds the default character limit

  • Correction file: [cFE source code] / osal / src / bsp / [target environment] /config/osconfig.h
  • Correction: Specify the value of OS_MAX_PATH_LEN larger than 64.

③ ENTRY_PT specified in Makefile, ④ If the name exceeds the default character limit

  • Modification file: main_func_name.yaml

5. Building procedure

5.1. Program execution (ROS-side)

The execution procedure of the ROS-side relay node is described below.
※ The ROS-side relay node is executed before the cFE-side relay application.

  1. Move directly under ROS catkin_ws
  2. Execute "catkin_make clean"
  3. Execute "catkin_make -i"
  4. Execute "catkin_make"
  5. Execute "rosrun relay_node relay_node"

5.2. Program execution (cFE-side)

The execution procedure of the ported ROS node and the cFE-side relay application is described below.

  1. Move directly below [cFE source code]
  2. Execute ". ./Setvars.sh"
  3. Move to [cFE source code] / build / cpu1
  4. Delete old ported ROS node and relay_app directory
  5. Execute "make config"
  6. Execute "make"
  7. Move to [cFE source code] / build / cpu1 / exe
  8. Execute "sudo su"
  9. Execute "./core-linux.bin"

6. Examples

that's all