nasa / nos3

NASA Operational Simulator for Small Satellites
Other
368 stars 82 forks source link

Installing directly on Linux #338

Closed matt11matthew closed 3 months ago

matt11matthew commented 3 months ago

Is there a certain process I would need to follow for installing NOS3 directly on a Linux machine? I would just clone the repo with docker installed and run make clean, make prep, make, etc...? Just confirming that there aren't anymore additional steps before requesting a independent Linux machine since the machine I'm using for a VM is not powerful enough to run Cosmos5.

gardinwin commented 3 months ago

I have received a mail from NASA :

For option A you can simply clone the repository then following the instructions under Getting started (https://github.com/nasa/nos3?tab=readme-ov-file#getting-started) assuming you navigate into the cloned repository. For example:

git clone https://github.com/nasa/nos3.git
cd nos3
git checkout dev
git submodule update --init --recursive
make prep
make
make launch

but make step has error : sudo make make config make[1]: Entering directory '/home/polemotion/nos3' ./scripts/config.sh start-time: 814048200.0 start-time-utc: 2025-10-18 08:30:00 gsw : cosmos number-spacecraft: 1 make[1]: Leaving directory '/home/polemotion/nos3' make fsw make[1]: Entering directory '/home/polemotion/nos3' ./scripts/docker_build_fsw.sh mkdir -p /home/polemotion/nos3/fsw/build cd /home/polemotion/nos3/fsw/build && cmake -DCMAKE_INSTALL_PREFIX=exe -DCMAKE_BUILD_TYPE=debug ../cfe CMake Error: The current CMakeCache.txt directory /home/polemotion/nos3/fsw/build/CMakeCache.txt is different than the directory /home/jstar/Desktop/github-nos3/fsw/build where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt CMake Error: The source "/home/polemotion/nos3/fsw/cfe/CMakeLists.txt" does not match the source "/home/jstar/Desktop/github-nos3/fsw/cfe/CMakeLists.txt" used to generate cache. Re-run cmake with a different source directory. make: [Makefile:56: build-fsw] Error 1 Makefile:92: recipe for target 'fsw' failed make[1]: [fsw] Error 2 make[1]: Leaving directory '/home/polemotion/nos3' Makefile:44: recipe for target 'all' failed make: *** [all] Error 2

gardinwin commented 3 months ago

i success install after clean optionB but python cannot launch gui error, i will upgrade ubuntu or python version.

jlucas9 commented 3 months ago

Let us know if you continue to run into issues you think we can help with!

matt11matthew commented 3 months ago

Would option A still work since I noticed someone else had issues with it? I don't have a way of creating a high powered VM so using option A directly on a Linux machine would be my only option for getting high GPU performance

gardinwin commented 3 months ago

Option A, make prep, make passed success, upgrade python version with mini conda. Depending on the version of Ubuntu, an upgrade of the Python version is required. When running make launch, there is a "docker container not found" error and the UI like 42 does not appear due to OpenGL issues. Anyone success in launch step ?

gardinwin commented 3 months ago

aftere version upgrade (ubuntu 18 -> 20), almost service are running ; but dbus error occured. which version is good for nos3 ?

matt11matthew commented 3 months ago

It seems to cause permission issues and issues with docker whenever you try and install directly on Linux

matt11matthew commented 3 months ago

Can someone help with the docker issue?

matt11matthew commented 3 months ago

The issue has been resolved.

gardinwin commented 3 months ago

I solved problems. in Makefile, i added sleep n seconds before start new docker. I think before docker exec. next docker connection fails. Have a good day.

gardinwin commented 2 months ago

!/bin/bash -i

#

Convenience script for NOS3 development

Use with the Dockerfile in the deployment repository

https://github.com/nasa-itc/deployment

#

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) source $SCRIPT_DIR/env.sh

Check that local NOS3 directory exists

if [ ! -d $USER_NOS3_DIR ]; then echo "" echo " Need to run make prep first!" echo "" exit 1 fi

Check that configure build directory exists

if [ ! -d $BASE_DIR/cfg/build ]; then echo "" echo " Need to run make config first!" echo "" exit 1 fi

echo "Make data folders..."

FSW Side

mkdir $FSW_DIR/data 2> /dev/null mkdir $FSW_DIR/data/cam 2> /dev/null mkdir $FSW_DIR/data/eo_cam 2> /dev/null mkdir $FSW_DIR/data/evs 2> /dev/null mkdir $FSW_DIR/data/hk 2> /dev/null mkdir $FSW_DIR/data/inst 2> /dev/null

GSW Side

mkdir /tmp/nos3 2> /dev/null mkdir /tmp/nos3/data 2> /dev/null mkdir /tmp/nos3/data/cam 2> /dev/null mkdir /tmp/nos3/data/eo_cam 2> /dev/null mkdir /tmp/nos3/data/evs 2> /dev/null mkdir /tmp/nos3/data/hk 2> /dev/null mkdir /tmp/nos3/data/inst 2> /dev/null mkdir /tmp/nos3/uplink 2> /dev/null cp $BASE_DIR/fsw/build/exe/cpu1/cf/cfe_es_startup.scr /tmp/nos3/uplink/tmp0.so 2> /dev/null cp $BASE_DIR/fsw/build/exe/cpu1/cf/sample.so /tmp/nos3/uplink/tmp1.so 2> /dev/null

echo "Create ground networks..." $DNETWORK create \ --driver=bridge \ --subnet=192.168.41.0/24 \ --gateway=192.168.41.1 \ nos3_core echo ""

echo "Launch GSW..." $BASE_DIR/cfg/build/gsw_launch.sh echo ""

echo "Create NOS interfaces..." export GND_CFG_FILE="-f nos3-simulator.xml" gnome-terminal --tab --title="NOS Terminal" -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name "nos_terminal" --network=nos3_core -w $SIM_BIN $DBOX ./nos3-single-simulator $GND_CFG_FILE stdio-terminal gnome-terminal --tab --title="NOS UDP Terminal" -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name "nos_udp_terminal" --network=nos3_core -w $SIM_BIN $DBOX ./nos3-single-simulator $GND_CFG_FILE udp-terminal echo ""

Note only currently working with a single spacecraft

export SATNUM=1

#

Spacecraft Loop

# for (( i=1; i<=$SATNUM; i++ )) do export SCNUM="sc"$i export SCNETNAME="nos3"$SC_NUM export SC_CFGFILE="-f nos3-simulator.xml" #"-f sc"$i"_nos3_simulator.xml"

# Debugging
#echo "Spacecraft number        = " $SC_NUM
#echo "Spacecraft network       = " $SC_NETNAME
#echo "Spacecraft configuration = " $SC_CFG_FILE

echo $SC_NUM " - Create spacecraft network..."
$DNETWORK create $SC_NETNAME 2> /dev/null
echo ""

echo $SC_NUM " - Connect COSMOS to spacecraft network..."
while ! $DNETWORK connect $SC_NETNAME cosmos_openc3-operator_1 --alias cosmos; do echo "retry..." && sleep 3; done; echo "success..."

echo $SC_NUM " - 42..."
rm -rf $USER_NOS3_DIR/42/NOS3InOut
cp -r $BASE_DIR/cfg/build/InOut $USER_NOS3_DIR/42/NOS3InOut
xhost +local:*
gnome-terminal --tab --title=$SC_NUM" - 42" -- $DFLAGS -e DISPLAY=$DISPLAY -v $USER_NOS3_DIR:$USER_NOS3_DIR -v /tmp/.X11-unix:/tmp/.X11-unix:ro --name $SC_NUM"_fortytwo" -h fortytwo --network=$SC_NETNAME -w $USER_NOS3_DIR/42 -t -p 4285:4285 $DBOX $USER_NOS3_DIR/42/42 NOS3InOut
echo ""

echo $SC_NUM " - Flight Software..."
cd $FSW_DIR
gnome-terminal --title=$SC_NUM" - NOS3 Flight Software" -- $DFLAGS -v $BASE_DIR:$BASE_DIR --name $SC_NUM"_nos_fsw" -h nos_fsw --network=$SC_NETNAME -w $FSW_DIR --sysctl fs.mqueue.msg_max=10000 --ulimit rtprio=99 --cap-add=sys_nice $DBOX $SCRIPT_DIR/fsw_respawn.sh &
#gnome-terminal --window-with-profile=KeepOpen --title=$SC_NUM" - NOS3 Flight Software" -- $DFLAGS -v $BASE_DIR:$BASE_DIR --name $SC_NUM"_nos_fsw" -h nos_fsw --network=$SC_NETNAME -w $FSW_DIR --sysctl fs.mqueue.msg_max=10000 --ulimit rtprio=99 --cap-add=sys_nice $DBOX $FSW_DIR/core-cpu1 -R PO &
echo ""

# Debugging
# Replace `--tab` with `--window-with-profile=KeepOpen` once you've created this gnome-terminal profile manually

echo $SC_NUM " - CryptoLib..."
gnome-terminal --tab --title=$SC_NUM" - CryptoLib" -- $DFLAGS -v $BASE_DIR:$BASE_DIR --name $SC_NUM"_cryptolib"  --network=$SC_NETNAME --network-alias=cryptolib -w $BASE_DIR/gsw/build $DBOX ./support/standalone
echo ""

echo $SC_NUM " - Simulators..."
cd $SIM_BIN
gnome-terminal --tab --title=$SC_NUM" - NOS Engine Server" -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name $SC_NUM"_nos_engine_server"  -h nos_engine_server --network=$SC_NETNAME -w $SIM_BIN $DBOX /usr/bin/nos_engine_server_standalone -f $SIM_BIN/nos_engine_server_config.json
gnome-terminal --tab --title=$SC_NUM" - 42 Truth Sim"      -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name $SC_NUM"_truth42sim"          -h truth42sim --network=$SC_NETNAME -w $SIM_BIN $DBOX ./nos3-single-simulator $SC_CFG_FILE  truth42sim
#gnome-terminal --tab --title=$SC_NUM" - Sim Term"      -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name $SC_NUM"_stdio-terminal"          -h stdio-terminal --network=$SC_NETNAME -w $SIM_BIN $DBOX ./nos3-single-simulator $SC_CFG_FILE  stdio-terminal    

while true; do
  $DNETWORK connect $SC_NETNAME nos_terminal
  resultNosTerm=$?

  $DNETWORK connect $SC_NETNAME nos_udp_terminal
  resultNosUdpTerm=$?

  if [ $resultNosTerm -eq 1 ] && [ $resultNosUdpTerm -eq 1 ]; then 
    echo "success..."
break
  fi

  echo "retry..."
  sleep 3
done

# Component simulators
#gnome-terminal --tab --title=$SC_NUM" - CAM Sim"      -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name $SC_NUM"_cam_sim"      --network=$SC_NETNAME -w $SIM_BIN $DBOX ./nos3-single-simulator $SC_CFG_FILE camsim
gnome-terminal --tab --title=$SC_NUM" - CSS Sim"      -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name $SC_NUM"_css_sim"      --network=$SC_NETNAME -w $SIM_BIN $DBOX ./nos3-single-simulator $SC_CFG_FILE generic_css_sim
gnome-terminal --tab --title=$SC_NUM" - EPS Sim"      -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name $SC_NUM"_eps_sim"      --network=$SC_NETNAME -w $SIM_BIN $DBOX ./nos3-single-simulator $SC_CFG_FILE generic_eps_sim
gnome-terminal --tab --title=$SC_NUM" - FSS Sim"      -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name $SC_NUM"_fss_sim"      --network=$SC_NETNAME -w $SIM_BIN $DBOX ./nos3-single-simulator $SC_CFG_FILE generic_fss_sim
gnome-terminal --tab --title=$SC_NUM" - GPS Sim"      -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name $SC_NUM"_gps_sim"      --network=$SC_NETNAME -w $SIM_BIN $DBOX ./nos3-single-simulator $SC_CFG_FILE gps
gnome-terminal --tab --title=$SC_NUM" - IMU Sim"      -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name $SC_NUM"_imu_sim"      --network=$SC_NETNAME -w $SIM_BIN $DBOX ./nos3-single-simulator $SC_CFG_FILE generic_imu_sim
gnome-terminal --tab --title=$SC_NUM" - MAG Sim"      -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name $SC_NUM"_mag_sim"      --network=$SC_NETNAME -w $SIM_BIN $DBOX ./nos3-single-simulator $SC_CFG_FILE generic_mag_sim
gnome-terminal --tab --title=$SC_NUM" - RW 0 Sim"     -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name $SC_NUM"_rw_sim0"      --network=$SC_NETNAME -w $SIM_BIN $DBOX ./nos3-single-simulator $SC_CFG_FILE generic-reactionwheel-sim0
gnome-terminal --tab --title=$SC_NUM" - RW 1 Sim"     -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name $SC_NUM"_rw_sim1"      --network=$SC_NETNAME -w $SIM_BIN $DBOX ./nos3-single-simulator $SC_CFG_FILE generic-reactionwheel-sim1
gnome-terminal --tab --title=$SC_NUM" - RW 2 Sim"     -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name $SC_NUM"_rw_sim2"      --network=$SC_NETNAME -w $SIM_BIN $DBOX ./nos3-single-simulator $SC_CFG_FILE generic-reactionwheel-sim2
gnome-terminal --tab --title=$SC_NUM" - SAT_CAM Sim"  -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name $SC_NUM"_sat_cam_sim"  --network=$SC_NETNAME -w $SIM_BIN $DBOX ./nos3-single-simulator $SC_CFG_FILE sat_cam_sim

gnome-terminal --tab --title=$SC_NUM" - Radio Sim"    -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name $SC_NUM"_radio_sim"    -h radio_sim --network=$SC_NETNAME --network-alias=radio_sim -w $SIM_BIN $DBOX ./nos3-single-simulator $SC_CFG_FILE generic_radio_sim

#gnome-terminal --tab --title=$SC_NUM" - Sample Sim"   -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name $SC_NUM"_sample_sim"   --network=$SC_NETNAME -w $SIM_BIN $DBOX ./nos3-single-simulator $SC_CFG_FILE sample_sim
gnome-terminal --tab --title=$SC_NUM" - StarTrk Sim"  -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name $SC_NUM"_startrk_sim"  --network=$SC_NETNAME -w $SIM_BIN $DBOX ./nos3-single-simulator $SC_CFG_FILE generic_star_tracker_sim
gnome-terminal --tab --title=$SC_NUM" - Torquer Sim"  -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name $SC_NUM"_torquer_sim"  --network=$SC_NETNAME -w $SIM_BIN $DBOX ./nos3-single-simulator $SC_CFG_FILE generic_torquer_sim
echo ""

done

echo "NOS Time Driver..." sleep 8 gnome-terminal --tab --title="NOS Time Driver" -- $DFLAGS -v $SIM_DIR:$SIM_DIR --name nos_time_driver --network=nos3_core -w $SIM_BIN $DBOX ./nos3-single-simulator $GND_CFG_FILE time sleep 1 for (( i=1; i<=$SATNUM; i++ )) do export SCNUM="sc"$i export SCNETNAME="nos3"$SC_NUM export TIMENAME=$SC_NUM"_nos_time_driver" while ! $DNETWORK connect --alias nos_time_driver $SC_NETNAME nos_time_driver; do echo "retry..." && sleep 3; done; echo "success..." done echo ""

echo "Docker launch script completed!"