Skip to content

Commit 4ff2dda

Browse files
committed
avoiding circular reference code (#2)
1 parent c750cae commit 4ff2dda

34 files changed

+114
-983
lines changed

racs2_demos_on_spaceros/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.8)
2-
project(racs2_demos_on_spaceros)
2+
project(mars_rover)
33

44
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
55
add_compile_options(-Wall -Wextra -Wpedantic)

racs2_demos_on_spaceros/Dockerfile

+24-7
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,17 @@ RUN git submodule update
6565

6666
# Get the RACS2 source code
6767
WORKDIR ${RACS2_DEMO_DIR}
68-
RUN git clone https://github.com/jaxa/racs2_bridge
68+
RUN git clone https://github.com/jaxa/racs2_bridge -b v1.1
6969

7070
# Get the demo source code
7171
# rename old demo directory and exclude from build
7272
WORKDIR ${DEMO_DIR}/src
73-
RUN mv demos demos_old
73+
# RUN mv demos demos_old
74+
RUN cp -r demos demos_old
7475
RUN touch demos_old/COLCON_IGNORE
7576
# git clone new demo
76-
RUN git clone https://github.com/tt-saito/demos.git -b racs2_demo
77+
# RUN git clone https://github.com/tt-saito/demos.git -b racs2_demo2
78+
# RUN git clone https://github.com/space-ros/demos
7779

7880
# Customize cFS to run the bridge
7981
WORKDIR ${RACS2_DEMO_DIR}/cfs
@@ -82,8 +84,12 @@ RUN cp -r cfe/cmake/sample_defs sample_defs
8284
RUN cp -pr ${RACS2_DEMO_DIR}/racs2_bridge/cFS/Bridge/Client_C/apps/racs2_bridge_client apps/
8385

8486
# Deploy the run_app application and adjust the startup scripts
85-
RUN cp -pr ${DEMO_DIR}/src/demos/mars_rover/cFS/sample_defs/* ${RACS2_DEMO_DIR}/cfs/sample_defs/
86-
RUN cp -pr ${DEMO_DIR}/src/demos/mars_rover/cFS/apps/run_app ${RACS2_DEMO_DIR}/cfs/apps/
87+
# RUN cp -pr ${DEMO_DIR}/src/demos/racs2_demos_on_spaceros/cFS/sample_defs/* ${RACS2_DEMO_DIR}/cfs/sample_defs/
88+
# RUN cp -pr ${DEMO_DIR}/src/demos/racs2_demos_on_spaceros/cFS/apps/run_app ${RACS2_DEMO_DIR}/cfs/apps/
89+
COPY cFS/sample_defs/cpu1_cfe_es_startup.scr ${RACS2_DEMO_DIR}/cfs/sample_defs/cpu1_cfe_es_startup.scr
90+
COPY cFS/sample_defs/racs2_bridge_config.txt ${RACS2_DEMO_DIR}/cfs/sample_defs/racs2_bridge_config.txt
91+
COPY cFS/sample_defs/targets.cmake ${RACS2_DEMO_DIR}/cfs/sample_defs/targets.cmake
92+
COPY cFS/apps/run_app ${RACS2_DEMO_DIR}/cfs/apps/run_app
8793

8894
# This is necessary to run cFS inside docker
8995
RUN sed -i -e 's/^#undef OSAL_DEBUG_PERMISSIVE_MODE/#define OSAL_DEBUG_PERMISSIVE_MODE 1/g' sample_defs/default_osconfig.h
@@ -103,14 +109,25 @@ WORKDIR ${DEMO_DIR}
103109
# Copy bridge & racs2_msg node
104110
RUN cp -pr ${RACS2_DEMO_DIR}/racs2_bridge/ROS2/Bridge/Server_Python/bridge_py_s src/
105111
RUN cp -pr ${RACS2_DEMO_DIR}/racs2_bridge/Example/Case.1/ROS2/racs2_msg src/
106-
ENV ROSDISTRO=humble
112+
113+
114+
COPY CMakeLists.txt ${DEMO_DIR}/src/demos/mars_rover/CMakeLists.txt
115+
COPY package.xml ${DEMO_DIR}/src/demos/mars_rover/package.xml
116+
# COPY racs2_demos_on_spaceros ${DEMO_DIR}/src/demos/mars_rover/racs2_demos_on_spaceros
117+
COPY launch/mars_rover.launch.py ${DEMO_DIR}/src/demos/mars_rover/launch/mars_rover.launch.py
118+
COPY nodes/RACS2Bridge_geometry_msgs_pb2.py ${DEMO_DIR}/src/demos/mars_rover/nodes/RACS2Bridge_geometry_msgs_pb2.py
119+
COPY nodes/move_wheel ${DEMO_DIR}/src/demos/mars_rover/nodes/move_wheel
120+
121+
122+
123+
107124
# Install dependencies
108125
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
109126
--mount=type=cache,target=/var/lib/apt,sharing=locked \
110127
sudo apt-get update -y \
111128
&& /bin/bash -c 'source "${SPACEROS_DIR}/install/setup.bash"' \
112129
&& /bin/bash -c 'source "${MOVEIT2_DIR}/install/setup.bash"' \
113-
&& rosdep install --from-paths src --ignore-src -r -y --rosdistro ${ROSDISTRO}
130+
&& rosdep install --from-paths src --ignore-src -r -y --rosdistro ${ROS_DISTRO}
114131

115132
# Build the demo
116133
RUN /bin/bash -c 'source ${SPACEROS_DIR}/install/setup.bash && source ${MOVEIT2_DIR}/install/setup.bash \

racs2_demos_on_spaceros/README.md

+66-9
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,87 @@ The Dockerfile installs all of the prerequisite system dependencies along with t
77
This is RACS2 Bridge demo for Curiosity Mars rover.
88

99
## Building the Demo Docker
10-
To build:
10+
11+
The demo image builds on top of the `spaceros`, `moveit2`, `space_robots` images.
12+
To build the docker image, first ensure the `spaceros` base image is available either by [building it locally](https://github.com/space-ros/space-ros) or pulling it.
13+
14+
Then build the `moveit2`, `space_robots` and `racs2_demos_on_spaceros` demo images:
15+
1116
```bash
17+
git clone https://github.com/space-ros/docker.git
18+
cd docker/moveit2
19+
./build.sh
20+
cd ../space_robots
21+
./build.sh
22+
cd ../../
1223
./build.sh
1324
```
14-
For detail and please read docker/racs2_demos_on_spaceros/README.md
1525

1626
## Running the Demo Docker
17-
To run (enter docker environment by docker run):
27+
28+
(at /path/to/demos/racs2_demos_on_spaceros/docker/racs2_demos_on_spaceros)
29+
run the following to allow GUI passthrough:
30+
```bash
31+
xhost +local:docker
32+
```
33+
34+
Then run:
1835
```bash
1936
./run.sh
2037
```
21-
You will need three terminals to run demo.
2238

23-
For instractions after entering docker, please read docker/racs2_demos_on_spaceros/README.md
39+
Depending on the host computer, you might need to remove the ```--gpus all``` flag in ```run.sh```, which uses your GPUs.
2440

41+
## Running the Demos
2542

26-
## Reference
43+
### Curiosity Mars rover demo
44+
Launch the rover demo (calling Terminal 1):
45+
```bash
46+
source install/setup.bash
47+
ros2 launch mars_rover mars_rover.launch.py
48+
```
2749

28-
* [RACS2 Bridge by Japan Aerospace Exploration Agency (JAXA)](https://github.com/jaxa/racs2_bridge)
50+
#### RACS2 Bridge demo
2951

30-
* [Hiroki Kato and Tatsuhiko Saito, "RACS2: the ROS2 and cFS System - launched" Flight Software Workshop 2023.](https://drive.google.com/drive/folders/1C9fokWGDl2e4NfgX_ZU3f98FfPe9udwQ)
52+
##### Running racs2 bridge node
53+
Open a new terminal (calling Terminal 2) and attach to the currently running container:
54+
55+
```bash
56+
docker exec -it <container-name> bash
57+
source install/setup.bash
58+
ros2 run bridge_py_s bridge_py_s_node --ros-args --params-file ./src/bridge_py_s/config/params.yaml
59+
```
60+
61+
##### Running cFS bridge app & run_app app
62+
Open a new terminal (calling Terminal 3) and attach to the currently running container:
63+
64+
```bash
65+
docker exec -it <container-name> bash
66+
cd ~/racs2_ws
67+
cd cfs/build/exe/cpu1/
68+
./core-cpu1
69+
```
70+
71+
**Executing commands to the rover must be done with this terminal active.**
3172

32-
* [Hiroki Kato and Tatsuhiko Saito, "ROS and cFS System (RACS): Easing Space Robotic Development post-opensource activities and ROS2 integration" Flight Software Workshop 2021.](https://drive.google.com/file/d/11L48doT_pRNs7R0hdChPALqJO849TvV2/view?usp=drive_web)
3373

74+
##### Available Commands
3475

76+
Drive commands to the rover are input via keyboard in Terimnal 3. The keymap is as follows.
3577

78+
* "w": Drive the rover forward
79+
* "s": Drive the rover backward
80+
* "a": Turn left
81+
* "d": Turn right
82+
* "x": Stop the rover
3683

84+
##### Nodes
85+
![RACS2 demo on Space ROS Mars rover demo](racs2_demo_on_spaceros_nodes.png)
86+
87+
## Reference
88+
89+
* [RACS2 bridge project by Japan Aerospace Exploration Agency (JAXA)](https://github.com/jaxa/racs2_bridge)
90+
91+
* [Hiroki Kato and Tatsuhiko Saito, "RACS2: the ROS2 and cFS System - launched" Flight Software Workshop 2023.](https://drive.google.com/drive/folders/1C9fokWGDl2e4NfgX_ZU3f98FfPe9udwQ)
92+
93+
* [Hiroki Kato and Tatsuhiko Saito, "ROS and cFS System (RACS): Easing Space Robotic Development post-opensource activities and ROS2 integration" Flight Software Workshop 2021.](https://drive.google.com/file/d/11L48doT_pRNs7R0hdChPALqJO849TvV2/view?usp=drive_web)

racs2_demos_on_spaceros/build.sh

+3-10
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,11 @@ set -eo pipefail
1212

1313
echo ""
1414
echo "##### Building RACS2 Demo on Space ROS Docker Image #####"
15-
echo "##### moveit2 -> space_robots -> racs2_demos_on_spaceros #####"
1615
echo ""
1716

18-
cd docker/moveit2
19-
./build.sh
20-
cd ../space_robots
21-
./build.sh
22-
cd ../racs2_demos_on_spaceros
23-
./build.sh
24-
cd ..
25-
cd ..
26-
```
17+
docker build -t $ORG/$IMAGE:$TAG \
18+
--build-arg VCS_REF="$VCS_REF" \
19+
--build-arg VERSION="$VERSION" .
2720

2821
echo ""
2922
echo "##### Done! #####"

racs2_demos_on_spaceros/docker/moveit2/Dockerfile

-155
This file was deleted.

0 commit comments

Comments
 (0)