Open ryuxin opened 2 years ago
Hey Yuxin,
How are you? I'd suggest start from here: https://github.com/gwsystems/OpenSatKit
Yes, OpenSatKit has dependencies, sure, and a 42 simulator that runs with UI, so you'd need to get that. I remember us playing traces instead of using the 42 simulator, but I hate to say that my email.gwu.edu mail has been disabled abruptly (before I could backup, without notice I guess) a while back, and lost all of my mails from that mailbox, to even dig and help. I remember writing up some email on how to set this up (tracing infra) and use (especially using the Composite + cFE + OSK) and sharing with an external collaborator if that's something you'd be interested in playing with. Perhaps ping Gabe to see if he can dig some of the emails that we shared with the external collaborators that were using the infra for using ML etc for offline training and online failure detection etc. So I vaguely remember all of these details but worst part, I have no emails that I could dig for you.
Thanks a lot for your quick response @phanikishoreg I have looked at OpenSatKit, and I compiled the cFE and 42 code from its source. However, I cannot run cosmos component in OpenSatKit due to lack of GUI environment. I guess cosmos is not necessary in some sense, as it is possible to write a simple app to issues command to cFE. I guess the telemetry app in composite act as a simple ground system (https://github.com/gwsystems/composite/tree/rump_cfe_integration/src/components/implementation/no_interface/tele). So I have some concrete questions in Linux.
@gparmer do you have some instructions or scripts to run cFE system on Linux? Complete instructions is not necessary, and it is enough to just boot me up.
Thanks! Yuxin
Here's some instructions for running in the stale composite branch from Phani. Couldn't find any others. @phanikishoreg are these what you were thinking about?
Following are the code changes you'd have to make to get 42 simulator and cFE in Composite to talk directly to each other:
Uncomment code in cFE/apps/i42/fsw/src/netif.c and cFE/apps/i42/fsw/src/i42_app.c to use networking in i42.
Comment out the lines that create a OS_Queue for sensor replay code. https://github.com/gwsystems/cFE/blob/79e5d647d00e51c427b99d4c251ba768539ba712/apps/i42/fsw/src/i42_app.c#L218-L230
Update cFE/apps/i42/fsw/platform_inc/i42_platform_cfg.h to use the correct IP and HOST-name of the host running 42 simulator.
Add "i42stub" in to that array and update array size macro!
Link to posix_rk.c in src/components/implementation/no_interface/i42/ instead of posix_common.c and call posix_rk_init(0); in init.c like in kit_to and kit_ci apps do.
Comment out code that spawns a HPET sensor emulation thread here, https://github.com/gwsystems/composite/blob/rump_cfe_recovery/src/components/implementation/no_interface/cFE_booter/cFE_entrypoint.c#L125-L135
Make a copy of one of the script files, like kittostub_kitcistub_udptrace_rumpboot.sh into a kittostub_kitcistub_i42stub_udptrace_rumpboot.sh and update the copy to have similar dependencies like kitcistub and kittostub for i42stub.
- https://github.com/gwsystems/composite/blob/rump_cfe_recovery/src/platform/i386/runscripts/kittostub_kitcistub_udptrace_rumpboot.sh#L7 make a copy of rk_stubcomp.o to i42stub.o change "i42.o, ;" to "i42.o,'r3';" add "i42stub.o,'r3';" as another component add i42stub.o-rumpcos.o|capmgr.o; dependency
In 42 simulator, update this file to use the ip address of the cFS (composite) instance: https://github.com/gwsystems/OpenSatKit/blob/custom_level/42/InOut/Inp_IPC.txt#L4 Note: This will be the first time that i42 in cFE composite port is actually talking to 42 simulator as we had previously captured the sensor traces from a linux instance and replayed that for composite cFE.
I don't think we'd need any changes in cosmos though. Please let me know if you need more information.
Phani
Some additional resources:
The purpose of this document is to share the steps I followed to have CFS and COSMOS run on different machines (remote hosts) and talk to each other over the wire.
hostname -s
command)192.168.0.1
, subnet as 24
and gateway as 192.168.0.1
.192.168.0.2
, subnet as 24
and gateway as 192.168.0.1
./etc/hosts
on COSMOS and add an entry for hostname resolution for the CFS target. Similarly, edit it on the CFS machine and add COSMOS's hostname in there.To make sure all ports are accessible and nothing is blocked by firewall or iptables on either systems: (I remember having some trouble in connecting both systems, so I did this. But you may not want to do this unless you have some connection problems like "connection refused" or something.)
You've to do these on both host and target PCs.
NOTE:
I've run into a problem where the Ubuntu GUI just crashed after removing apparmor on one of the machines. If this happens to you, you'll need to follow the below steps to recover (not so easy):
1. ctrl + alt + f2 when you see that error that says cannot start GUI for login on Ubuntu so you can login using cmdline.
2. if you're not on network, you'd need to get that up.
=> ifdown eth0; ifup eth0
This may not work if you're using network manager.
Well, add to /etc/network/interfaces your interface name (like "eth0").
Look up online, and make sure you've configured or editted /etc/network/interfaces to correctly use dhcp or static depending on your network policies. You need to be online to use apt-get. (or have the ubuntu-desktop and unity packages downloaded)
=> ifup eth0
This should connect now.
3. mv ~/.config ~/.config.bak
4. reinstall ubuntu-desktop and unity packages
5. Reboot. This should fix it. :) It did for me.
If you like to connect to 42 simulator
running on the COSMOS host machine, you'll need to follow the below seps.
OpenSatKit-master/cfs/apps/i42/fsw/platform_inc/i42_platform_cfg.h
I42_LOCAL_HOST_STR
to use the hostname of the COSMOS machineI42_SOCKET_ADDR_STR
to use the IP address of the COSMOS machine. (Use the fixed length IP format. In my case it was, "192.168.000.001").OpenSatKit-master/42/InOut/Inp_IPC.txt
and edit the hostname there to point to the hostname of the CFS target.NOTE:
* These steps are not necessary if you don't want to run the 42 simulator for this test.
* Because we're going to replace the 42 simulator with a 42 sensor trace replay application for most of our tests on both systems so you may not want to try this step.
* Because that is our goal (to use sensor trace replay), I've not really verified if this communication works correctly.
For this, all modifications you need to make are local to COSMOS directory in the OpenSatKit of the COSMOS machine.
Steps:
OpenSatKit-master/cosmos
directory.
-> grep -e "127.0.0.1" -e "localhost" * -rnconfig/tools/cmd_tlm_server/cmd_tlm_server.txt
to replace 127.0.0.1
to use the IP address of the CFS target.config/targets/KIT_TO/cmd_tlm/kit_to_cmd.txt
to replace 127.0.0.1
to use the IP address of the COSMOS machine. This IP address is passed to CFS through KIT_CI and the KIT_TO app in CFS connects to that IP address to send out the telemetry data.lib/cfs_kit_global.rb
, LOCAL_IP_ADDR
to use CFS IP address.lib/osk_global.rb
, COSMOS_IP_ADDR
to use the COSMOS machine's external IP address and not the loopback address.lib/osk_system.rb
, in the function def connect_to_local_cfs()
to pass the second parameter to be the IP address of the CFS target machine.config/targets/CFS_KIT/lib/cfs_kit_screen.rb
and comment out the lines that spawn and enable telemetry to the CFS. (Lines #61-106). This means, you'll have to manually run CFS on the CFS target machine and click on Enable Telemetry on COSMOS GUI after the CFS is up.ruby Launcher
on COSMOS to bring up the GUI.CFS Steps:
cfs/build/exe/cpu1
in the OpenSatKit on the CFS target machine.sudo ./core-cpu1
.Go back to the COSMOS machine and click on Enable Telemetry. This should show a log in CFS console saying Telemetry output enabled for <XXXXXXXXXXXXXX>
and the same log should appear on the COSMOS GUI.
Hope that helps! Awesome that you're using CFS!
Yes, that's what I was looking for. Hope that helps @ryuxin! Thanks for digging that up, @gparmer!!
Thank you so much for the detailed instructions! I will follow this and ask more question if necessary.
Is there any tutorial I can learn how to run cFE on linux? especially to replay the experiments on Chaos paper? I tried OpenSatKit, but it has too many dependencies and is heavyweight. @phanikishoreg
Thanks Yuxin