-
Notifications
You must be signed in to change notification settings - Fork 3
Relay example type4
Follow "Environment construction" in Manual.
-
Edit the following “roscfe/config.ini” file according to the worker's environment.
[setting] ; Output cfe directory path cfe_path=/home/jaxa/roscfe_ws/cFE-6.5.0-OSS-release/apps ; Output ros directory path ros_path=/home/jaxa/catkin_ws/src ; Log directory path log_dir_path=./ ; Set path of convert target pkg directory path and read target launch file target_path=./convert_list.txt ; Whether to create relay_node and relay_app(1: create, 0: not create) create_relay_flag=0 ; Set path of main function name setting main_func_path=./main_func_name.yaml
-
Change 1: Change "cfe_path" to match the path of "apps" in your cFE project.
Example)
cfe_path=/home/yuyuqq/cFE-6.5.0-OSS-release/apps
-
Change 2: Change "ros_path" to match the path of the ROS workspace.
Example)
ros_path=/home/yuyuqq/catkin_ws/src
-
-
Clone the "HK" from NASA's repository into cFE "apps" directory and apply patch("roscfe/tutorial/ros_cfe_relay/type4/cfe/apps/hk/hk_app.c.patch") to "hk/fsw/src/hk_app.c".
Example)
cd /home/yuyuqq/cFE-6.5.0-OSS-release/apps/ git clone https://github.com/nasa/HK.git -b 2.4.1 hk cd hk/fsw/src patch -u hk_app.c < /home/yuyuqq/roscfe/tutorial/ros_cfe_relay/type4/cfe/apps/hk/hk_app.c.patch
-
Copy the "hk_ps" directory from "roscfe/tutorial/ros_cfe_relay/type4/cfe/apps/hk_ps" to cFE "apps" directory.
Example)
cp -r /home/yuyuqq/roscfe/tutorial/ros_cfe_relay/type4/cfe/apps/hk_ps /home/yuyuqq/cFE-6.5.0-OSS-release/apps/
-
Copy the "convert_lib" directory from "roscfe/convert_lib" to cFE "apps" directory.
Example)
cp -r /home/yuyuqq/roscfe/convert_lib /home/yuyuqq/cFE-6.5.0-OSS-release/apps/
-
Copy the "hk_pub" & "hk_sub" directory from "roscfe/hk_pub" & "roscfe/hk_sub" to ROS "src" directory.
Example)
cp -r /home/yuyuqq/roscfe/hk_pub /home/yuyuqq/catkin_ws/src/ cp -r /home/yuyuqq/roscfe/hk_sub /home/yuyuqq/catkin_ws/src/
-
Edit "roscfe/cfs_converter/relay_base/relay_node_base/launch/Connection.launch". (** You can leave the default **)
<launch> <ros_relay_node protocol="tcp" port="9876" port_send="9877" ip_addr="127.0.0.1" ring_length="30" /> <cfe_relay_app port="9877" port_send="9876" ip_addr="127.0.0.1" ring_length="30" /> <include file="./MsgId2Topic.launch" /> </launch>
- The items that can be set:
- ros_relay_node tag, cfe_relay_app tag
- protocol: "tcp" or "udp"
- port: Relay message receiving port number
- port_send: Relay message sending port number
- ip_addr: IP address of the relay message destination (specify "127.0.0.1" for local execution)
- ring_length: Buffer size of incoming messages
- ros_relay_node tag, cfe_relay_app tag
- The items that can be set:
-
Edit the "roscfe/cfs_converter/relay_base/relay_node_base/launch/MsgId2Topic.launch" as follows.
<launch> <correspond topic="/cfs_hk/ground_command" msg_id="0x189A" cfe_data_type="CFE_SB_CmdHdr_t" ros_data_type="relay_node::CFE_SB_CmdHdr" sender="0" /> <correspond topic="/cfs_hk/hk_telemetry" msg_id="0x089B" cfe_data_type="HK_HkPacket_t" ros_data_type="relay_node::HK_HkPacket" sender="1" /> </launch>
-
Go to "roscfe/cfs_converter" and run "start_cfs_relay.sh".
cd roscfe/cfs_converter chmod +x start_cfs_relay.sh ./start_cfs_relay.sh
-
If the execution is successful, the following message will be displayed at the end of the output.
Finish creating cFS relay app & ROS relay node
-
After execution, "relay_app" directories will be created in the cFE project directory as shown below.
cFE-6.5.0-OSS-release `-- apps |-- XXXX |-- relay_app |-- XXXX |-- XXXX `-- XXXX
The "relay_node" directory is created in the ROS workspace as shown below.
catkin_ws `-- src |-- relay_node |-- XXXX `-- XXXX
-
-
Copy the "Makefile" from "roscfe/tutorial/ros_cfe_relay/type4/cfe/build/cpu1/Makefile" to cFE "build/cpu1" directory.
Example)
cp -r /home/yuyuqq/roscfe/tutorial/ros_cfe_relay/type4/cfe/build/cpu1/Makefile /home/yuyuqq/cFE-6.5.0-OSS-release/build/cpu1/
-
Copy the "cfe_es_startup.scr" from "roscfe/tutorial/ros_cfe_relay/type4/cfe/build/cpu1/exe/cfe_es_startup.scr" to cFE "build/cpu1/exe" directory.
Example)
cp -r /home/yuyuqq/roscfe/tutorial/ros_cfe_relay/type4/cfe/build/cpu1/exe/cfe_es_startup.scr /home/yuyuqq/cFE-6.5.0-OSS-release/build/cpu1/exe/
-
Go to the ROS workspace and run the following command
catkin_make clean catkin_make -i catkin_make
-
Go to "cFE-6.5.0-OSS-release" and execute the following commands in order
. ./setvars.sh cd build/cpu1 make config make
Follow the procedure below to subscribe to the message delivered by the ROS sample_pub node with the cFE conversion sample_sub app. (** Be sure to execute from the ROS side **)
-
Execute the following command to start roscore
roscore
-
Open a new terminal, go to the ROS workspace and execute the following command to start the relay node.
source devel/setup.bash rosrun relay_node relay_node
-
Open a new terminal, go to the ROS workspace and run the following command to launch the hk_pub node
source devel/setup.bash roslaunch hk_pub bringup.launch
-
Open a new terminal, go to the ROS workspace and run the following command to launch the hk_sub node
source devel/setup.bash roslaunch hk_sub bringup.launch
-
Go to "cFE-6.5.0-OSS-release" and execute the following commands in order to start the relay application and conversion sample_pub application.
cd build/cpu1/exe sudo su ./core-linux.bin
-
Switch the terminal to "hk_pub" node on ROS side, you can see the below message on terminal.
please enter key.
-
Hit the enter key, you can see the below message.
[command_pub][49:03.069608] publish /cfs_hk/ground_command
-
The following message appears on the terminal "hk_pub" on cFE side. It means the command message from hk_pub has been received.
... [HK][55:12.990908] subscribe 0x189a EVS Port1 66/1/HK 4: HK No-op command, Version 2.4.1.0 ... ``
-
Hit the enter key on terminal on cFE side, you can see the below message.
... [HK_Driver][14:21.470792] publish 0x189B [HK][14:21.470802] subscribe 0x189b [HK][14:21.470884] publish 0x089B [HK_Driver][14:21.471209] subscribe 0x089B ...
-
The following message appears on the terminal "hk_sub" on ROS side. It means the telemetry message from hk has been received. "CmdCounter" shows the number of command sent from ROS side so far.
... [show_result][15:46.928565] subscribe /cfs_hk/hk_telemetry [show_result][15:46.928565] CmdCounter = 0 ...