diff --git a/jaxa_integration/Dockerfile.jaxa_spaceros_cfs b/jaxa_integration/Dockerfile.jaxa_spaceros_cfs new file mode 100644 index 00000000..c41b3416 --- /dev/null +++ b/jaxa_integration/Dockerfile.jaxa_spaceros_cfs @@ -0,0 +1,71 @@ +# ----------------------------------------------------------------------------- +# Dockerfile for setting up an environment with Space ROS and cFS +# Author: Minahil Raza +# Date: minahilrz@gmail.com +# ----------------------------------------------------------------------------- + +FROM osrf/space-ros:latest + +# Set environment variables +ENV JAXA_BRIDGE_DIR=/tmp/racs2_bridge +ENV CFS_DIR=${HOME_DIR}/cfs + +# Install dependencies for the ROS - cFS bridge +RUN sudo apt-get install -y libwebsockets-dev protobuf-c-compiler libprotobuf-c-dev python3-pip git \ + && pip3 install protobuf websockets + +# Set working directory and clone the JAXA bridge repository +WORKDIR ${HOME_DIR} +RUN git clone https://github.com/jaxa/racs2_bridge ${JAXA_BRIDGE_DIR} + +# Prepare cFS + +## Clone cFS repository +RUN git clone --recursive -b v6.7.0a https://github.com/nasa/cFS/ ${CFS_DIR} +WORKDIR ${CFS_DIR} +RUN git submodule init \ + && git submodule update + +## Customize cFS to run the bridge +RUN cp cfe/cmake/Makefile.sample Makefile \ + && cp -r cfe/cmake/sample_defs sample_defs \ + && cp -pr ${JAXA_BRIDGE_DIR}/cFS/Bridge/Client_C/apps/racs2_bridge_client ${CFS_DIR}/apps/ + +# Uncomment the following line if you only want the bridge and not the sample app. +# RUN cp -p ${JAXA_BRIDGE_DIR}/cFS/Bridge/Client_C/sample_defs/* ${CFS_DIR}/sample_defs/ + +## Deploy the sample talker application and adjust the startup scripts +RUN cp -pr ${JAXA_BRIDGE_DIR}/Example/Case.1/cFS/sample_defs/* ${CFS_DIR}/sample_defs/ +COPY ./cFS_app_examples/space_robots/cfs_app/sample_talker ${CFS_DIR}/apps/sample_talker + +## Adjust settings for running cFS inside Docker +RUN sed -i -e 's/^#undef OSAL_DEBUG_PERMISSIVE_MODE/#define OSAL_DEBUG_PERMISSIVE_MODE 1/g' sample_defs/default_osconfig.h \ + && sed -i -e 's/^#undef OSAL_DEBUG_DISABLE_TASK_PRIORITIES/#define OSAL_DEBUG_DISABLE_TASK_PRIORITIES 1/g' sample_defs/default_osconfig.h \ + && sed -i -e 's/^wss_uri=.*/wss_uri=127.0.0.1/g' sample_defs/racs2_bridge_config.txt + +## Compile cFS +RUN make SIMULATION=native prep \ + && make \ + && make install + +# Prepare ROS packages + +## Create ROS workspace +WORKDIR ${HOME_DIR} +RUN mkdir -p ros2-project/src + +## Copy bridge and example packages into the workspace +RUN cp -pr ${JAXA_BRIDGE_DIR}/ROS2/Bridge/Server_Python/bridge_py_s ${HOME_DIR}/ros2-project/src/ +COPY ./racs2_msg ${HOME_DIR}/ros2-project/src/racs2_msg + +## Compile and install ROS 2 packages +WORKDIR ${HOME_DIR}/ros2-project +SHELL ["/bin/bash", "-c"] +RUN source ${HOME_DIR}/spaceros/install/setup.bash && colcon build --symlink-install + +## Adjust configuration for the JAXA bridge (IPv4 settings) +RUN sed -i -e 's/wss_uri:.*/wss_uri: "127.0.0.1"/g' ./src/bridge_py_s/config/params.yaml + +# Set the default shell in screen to bash +RUN echo "defshell -bash" > ${HOME_DIR}/.screenrc + diff --git a/jaxa_integration/Dockerfile.jaxa_spaceros_listener b/jaxa_integration/Dockerfile.jaxa_spaceros_listener new file mode 100644 index 00000000..e231fb66 --- /dev/null +++ b/jaxa_integration/Dockerfile.jaxa_spaceros_listener @@ -0,0 +1,23 @@ +FROM osrf/space-ros:latest + +# Define key locations +ENV JAXA_ROS_DIR=${HOME_DIR}/jaxa_comm_ws +ENV JAXA_COMM_DIR=${JAXA_ROS_DIR}/src/jaxa_comm_spaceros +ENV JAXA_MSG_DIR=${JAXA_ROS_DIR}/src/racs2_msg + +# Copy package files for jaxa bridge +RUN mkdir -p $JAXA_COMM_DIR +COPY --chown=${USERNAME}:${USERNAME} ./jaxa_comm_spaceros $JAXA_COMM_DIR +RUN mkdir -p $JAXA_MSG_DIR +COPY --chown=${USERNAME}:${USERNAME} ./racs2_msg $JAXA_MSG_DIR + +# install protobuf +RUN pip install protobuf==3.20.1 + +# Build packages +WORKDIR ${JAXA_ROS_DIR} + +RUN /bin/bash -c 'source ${SPACEROS_DIR}/install/setup.bash \ + && colcon build' + +CMD ["bash"] diff --git a/jaxa_integration/README.md b/jaxa_integration/README.md new file mode 100644 index 00000000..ba0f0bfb --- /dev/null +++ b/jaxa_integration/README.md @@ -0,0 +1,135 @@ +# JAXA RACS2 Bridge Demo + +This demo demonstrates the use of the [RACS2](https://github.com/jaxa/racs2_bridge) (ROS and cFS System 2) Bridge to facilitate communication between {Space ROS](https://github.com/space-ros) and [Core Flight Executives (cFE)](https://github.com/nasa/cFE). The cFE is a core component of NASA-supplied spacecraft software, the [Core Flight System (CFS)](https://github.com/nasa/cFS). + +This code is a part of the following challenge: +- Challenge Name: NASA Space ROS Sim Summer Sprint Challenge +- Team Lead Freelancer Username: minahilrz +- Submission Title: JAXA RACS2 Bridge Demo + +## Directory Overview + +- **jaxa_comm_spaceros**: A ROS2 package for communication over the bridge. This ROS2 package allows spawning listener nodes to receive messages over the RACS2 Bridge. +- **racs2_msg**: A ROS2 package containing message definitions for communication between ROS2 and cFS. +- **cFS_app_examples**: Example apps for cFS. +- **Dockerfile.jaxa_spaceros_cfs**: Dockerfile for building the `jaxa_spaceros_cfs` container. It uses the spaceros image as its base. +- **Dockerfile.jaxa_spaceros_listener**: Dockerfile for building the `jaxa_spaceros_listener` container. It uses the spaceros image as its base. +- **run_jaxa_spaceros_cfs.sh**: Script to run the `jaxa_spaceros_cfs` container. +- **run_jaxa_spaceros_listener.sh**: Script to run the `jaxa_spaceros_listener` container. +- **build.sh**: Script to build two Docker images: `jaxa_spaceros_listener` and `jaxa_spaceros_cfs`. + + +## Dependencies + +To get started, ensure you have Docker Desktop installed on your system. This tutorial uses the Space ROS image, which can either be pulled from a registry or built locally. + +## Build Instructions + +To build the two necessary Docker containers, simply run the provided `build.sh` script: + +```bash +./build.sh +``` + +Once completed, you will have two Docker images: **jaxa_spaceros_listener** and **jaxa_spaceros_cfs**. + +## Usage Instructions +### Terminal 1: Start the cFS Container + +To start the `jaxa_spaceros_cfs` container, run: +```bash +./run_jaxa_spaceros_cfs.sh +``` + +When the bash terminal for the container opens, execute the following commands to start the bridge nodes: +```bash +source install/setup.bash +ros2 run bridge_py_s bridge_py_s_node --ros-args --params-file ./src/bridge_py_s/config/params.yaml +``` + +### Terminal 2: Start the cFE Publisher +Connect to the same `jaxa_spaceros_cfs` container using +```bash +docker exec -it jaxa_spaceros_cfs bash +``` + +Now, run the following commands inside the container to send messages over the bridge: +```bash +cd ../cfs/build/exe/cpu1/ +./core-cpu1 +``` + +### Terminal 3: Start the Listener Node +The `jaxa_comm_spaceros` package provides different examples of listener nodes, including demos of interacting with the Curiosity Rover and Canadarm. + +#### Example 1: Simple Listener Demo +In this example, a simple listener node is spawned which would receive the message and print it. + +First, run the `jaxa_spaceros_listener` container using the following script: +```bash +./run_jaxa_spaceros_listener.sh +``` + +Then, run the following commands inside the container to start the listener node: +```bash +source install/setup.bash +ros2 run jaxa_comm_spaceros jaxa_simple_listener + +``` + +#### Example 2: JAXA Bridge and Curiosity Rover Demo +In this example, the listener node receives numbers as messages from the cFS (commands) over the bridge and performs an action accordingly including moving and stopping the rover, turning the rover, opening and closing the tool arm or the mast. + +You need to build the space_robots image or run the curiosity rover on your own machine prior to running this example by following the instructions in the [demos](https://github.com/space-ros/demos) and [docker](https://github.com/space-ros/docker/tree/main) repos. + +Once you run the demo docker container, launch the demo using: +```bash +ros2 launch mars_rover mars_rover.launch.py +``` + +Then, run the `jaxa_spaceros_listener` container using the following script: +```bash +./run_jaxa_spaceros_listener.sh +``` + +Then, run the following commands inside the container to start the rover listener node: +```bash +source install/setup.bash +ros2 run jaxa_comm_spaceros jaxa_rover_listener + +``` + +#### Example 3: JAXA Bridge and Canadarm Demo +In this example, the listener node receives numbers as messages from the cFS (commands) over the bridge and performs an action accordingly by calling services for the Canadarm. + +Similar to example 2, you need to build the space_robots image or run the Canadarm demo on your own machine prior to running this example. + +Once you run the demo docker container, launch the demo using: +```bash +ros2 launch canadarm canadarm.launch.py +``` + +Then, run the `jaxa_spaceros_listener` container using the following script: +```bash +./run_jaxa_spaceros_listener.sh +``` + +Then, run the following commands inside the container to start the canadarm listener node: +```bash +source install/setup.bash +ros2 run jaxa_comm_spaceros jaxa_canadarm_listener + +``` + +## Architecture +The main design goal was to simulate a real life situation where the listener would be running pn a different machine as compared to the system running the cFS. Therefore, this demo builds and runs two separate containers. The system architecture is provided below. + +![archiecture](images/architecture.png) + +## Using the jaxa_comm_package in other projects +The communication package can be used in any system which has ROS2 or SpaceROS installed. Copy the package files into your own workspace and use colcon to build it. + +## Notes +- When running ROS nodes inside docker containers, all the containers must be over the same network. +- The listener node can be run in the same spaceros container as the bridge and cFS. Two separate containers demonstrate a scenario where different systems are communicating over the RACS2 Bridge. + diff --git a/jaxa_integration/build.sh b/jaxa_integration/build.sh new file mode 100755 index 00000000..6caeb619 --- /dev/null +++ b/jaxa_integration/build.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# Define variables +APP1="jaxa_spaceros_cfs" +APP2="jaxa_spaceros_listener" + +# Define Docker image names +IMAGE1="jaxa_spaceros_cfs" +IMAGE2="jaxa_spaceros_listener" + +# Define Dockerfile names +DOCKERFILE1="Dockerfile.${APP1}" +DOCKERFILE2="Dockerfile.${APP2}" + +# Exit script with failure if build fails +set -eo pipefail + +# Build Docker images +echo "Building Docker image for ${APP1}..." +docker build -t $IMAGE1 -f $DOCKERFILE1 . + +echo "Building Docker image for ${APP2}..." +docker build -t $IMAGE2 -f $DOCKERFILE2 . + +echo "Docker images built successfully." + diff --git a/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/CMakeLists.txt b/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/CMakeLists.txt new file mode 100644 index 00000000..4159672e --- /dev/null +++ b/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 2.6.4) +project(CFE_SAMPLE_TALKER C) + +include_directories(fsw/mission_inc) +include_directories(fsw/platform_inc) + +aux_source_directory(fsw/src APP_SRC_FILES) + +# Create the app module +add_cfe_app(sample_talker ${APP_SRC_FILES}) + +target_link_libraries(sample_talker + ${PROTOBUF_LIBRARY} + protobuf-c +) \ No newline at end of file diff --git a/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/mission_inc/sample_talker_perfids.h b/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/mission_inc/sample_talker_perfids.h new file mode 100644 index 00000000..5755e4f8 --- /dev/null +++ b/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/mission_inc/sample_talker_perfids.h @@ -0,0 +1,7 @@ +#ifndef _sample_talker_perfids_h_ +#define _sample_talker_perfids_h_ + + +#define SAMPLE_APP_PERF_ID 91 + +#endif /* _sample_talker_perfids_h_ */ diff --git a/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/platform_inc/sample_talker_msgids.h b/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/platform_inc/sample_talker_msgids.h new file mode 100644 index 00000000..5a6eba35 --- /dev/null +++ b/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/platform_inc/sample_talker_msgids.h @@ -0,0 +1,9 @@ +#ifndef _sample_talker_msgids_h_ +#define _sample_talker_msgids_h_ + +#define SAMPLE_TALKER_CMD_MID 0x1892 +#define SAMPLE_TALKER_SEND_HK_MID 0x1893 +#define SAMPLE_TALKER_HK_TLM_MID 0x0893 +#define RACS2_BRIDGE_MID 0x1EFE + +#endif /* _sample_talker_msgids_h_ */ diff --git a/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/src/RACS2Brdige_std_msgs.pb-c.c b/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/src/RACS2Brdige_std_msgs.pb-c.c new file mode 100644 index 00000000..0512d65c --- /dev/null +++ b/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/src/RACS2Brdige_std_msgs.pb-c.c @@ -0,0 +1,261 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: RACS2Brdige_std_msgs.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "RACS2Brdige_std_msgs.pb-c.h" +void racs2_bridge_std_msgs__init + (RACS2BridgeStdMsgs *message) +{ + static const RACS2BridgeStdMsgs init_value = RACS2_BRIDGE_STD_MSGS__INIT; + *message = init_value; +} +size_t racs2_bridge_std_msgs__get_packed_size + (const RACS2BridgeStdMsgs *message) +{ + assert(message->base.descriptor == &racs2_bridge_std_msgs__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t racs2_bridge_std_msgs__pack + (const RACS2BridgeStdMsgs *message, + uint8_t *out) +{ + assert(message->base.descriptor == &racs2_bridge_std_msgs__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t racs2_bridge_std_msgs__pack_to_buffer + (const RACS2BridgeStdMsgs *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &racs2_bridge_std_msgs__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +RACS2BridgeStdMsgs * + racs2_bridge_std_msgs__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (RACS2BridgeStdMsgs *) + protobuf_c_message_unpack (&racs2_bridge_std_msgs__descriptor, + allocator, len, data); +} +void racs2_bridge_std_msgs__free_unpacked + (RACS2BridgeStdMsgs *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &racs2_bridge_std_msgs__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor racs2_bridge_std_msgs__field_descriptors[14] = +{ + { + "bool_data", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(RACS2BridgeStdMsgs, has_bool_data), + offsetof(RACS2BridgeStdMsgs, bool_data), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "float_data", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_FLOAT, + offsetof(RACS2BridgeStdMsgs, has_float_data), + offsetof(RACS2BridgeStdMsgs, float_data), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "double_data", + 3, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_DOUBLE, + offsetof(RACS2BridgeStdMsgs, has_double_data), + offsetof(RACS2BridgeStdMsgs, double_data), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "int32_data", + 4, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_INT32, + offsetof(RACS2BridgeStdMsgs, has_int32_data), + offsetof(RACS2BridgeStdMsgs, int32_data), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "int64_data", + 5, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_INT64, + offsetof(RACS2BridgeStdMsgs, has_int64_data), + offsetof(RACS2BridgeStdMsgs, int64_data), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "string_data", + 6, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(RACS2BridgeStdMsgs, string_data), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "uint32_data", + 7, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(RACS2BridgeStdMsgs, has_uint32_data), + offsetof(RACS2BridgeStdMsgs, uint32_data), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "uint64_data", + 8, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT64, + offsetof(RACS2BridgeStdMsgs, has_uint64_data), + offsetof(RACS2BridgeStdMsgs, uint64_data), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "float32_array_data", + 9, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_FLOAT, + offsetof(RACS2BridgeStdMsgs, n_float32_array_data), + offsetof(RACS2BridgeStdMsgs, float32_array_data), + NULL, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_PACKED, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "float64_array_data", + 10, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_DOUBLE, + offsetof(RACS2BridgeStdMsgs, n_float64_array_data), + offsetof(RACS2BridgeStdMsgs, float64_array_data), + NULL, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_PACKED, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "int32_array_data", + 11, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_INT32, + offsetof(RACS2BridgeStdMsgs, n_int32_array_data), + offsetof(RACS2BridgeStdMsgs, int32_array_data), + NULL, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_PACKED, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "int64_array_data", + 12, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_INT64, + offsetof(RACS2BridgeStdMsgs, n_int64_array_data), + offsetof(RACS2BridgeStdMsgs, int64_array_data), + NULL, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_PACKED, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "uint32_array_data", + 13, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_UINT32, + offsetof(RACS2BridgeStdMsgs, n_uint32_array_data), + offsetof(RACS2BridgeStdMsgs, uint32_array_data), + NULL, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_PACKED, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "uint64_array_data", + 14, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_UINT64, + offsetof(RACS2BridgeStdMsgs, n_uint64_array_data), + offsetof(RACS2BridgeStdMsgs, uint64_array_data), + NULL, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_PACKED, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned racs2_bridge_std_msgs__field_indices_by_name[] = { + 0, /* field[0] = bool_data */ + 2, /* field[2] = double_data */ + 8, /* field[8] = float32_array_data */ + 9, /* field[9] = float64_array_data */ + 1, /* field[1] = float_data */ + 10, /* field[10] = int32_array_data */ + 3, /* field[3] = int32_data */ + 11, /* field[11] = int64_array_data */ + 4, /* field[4] = int64_data */ + 5, /* field[5] = string_data */ + 12, /* field[12] = uint32_array_data */ + 6, /* field[6] = uint32_data */ + 13, /* field[13] = uint64_array_data */ + 7, /* field[7] = uint64_data */ +}; +static const ProtobufCIntRange racs2_bridge_std_msgs__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 14 } +}; +const ProtobufCMessageDescriptor racs2_bridge_std_msgs__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "RACS2Bridge_std_msgs", + "RACS2BridgeStdMsgs", + "RACS2BridgeStdMsgs", + "", + sizeof(RACS2BridgeStdMsgs), + 14, + racs2_bridge_std_msgs__field_descriptors, + racs2_bridge_std_msgs__field_indices_by_name, + 1, racs2_bridge_std_msgs__number_ranges, + (ProtobufCMessageInit) racs2_bridge_std_msgs__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/src/RACS2Brdige_std_msgs.pb-c.h b/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/src/RACS2Brdige_std_msgs.pb-c.h new file mode 100644 index 00000000..54a70aa5 --- /dev/null +++ b/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/src/RACS2Brdige_std_msgs.pb-c.h @@ -0,0 +1,139 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: RACS2Brdige_std_msgs.proto */ + +#ifndef PROTOBUF_C_RACS2Brdige_5fstd_5fmsgs_2eproto__INCLUDED +#define PROTOBUF_C_RACS2Brdige_5fstd_5fmsgs_2eproto__INCLUDED + +#include + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1000000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003003 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _RACS2BridgeStdMsgs RACS2BridgeStdMsgs; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _RACS2BridgeStdMsgs +{ + ProtobufCMessage base; + /* + * -- std_msgs/Bool --------------------------- + */ + protobuf_c_boolean has_bool_data; + protobuf_c_boolean bool_data; + /* + * -- std_msgs/Float32 --------------------------- + */ + protobuf_c_boolean has_float_data; + float float_data; + /* + * -- std_msgs/Float64 --------------------------- + */ + protobuf_c_boolean has_double_data; + double double_data; + /* + * -- std_msgs/Int32 --------------------------- + */ + protobuf_c_boolean has_int32_data; + int32_t int32_data; + /* + * -- std_msgs/Int64 --------------------------- + */ + protobuf_c_boolean has_int64_data; + int64_t int64_data; + /* + * -- std_msgs/String --------------------------- + */ + char *string_data; + /* + * -- std_msgs/Uint32 --------------------------- + */ + protobuf_c_boolean has_uint32_data; + uint32_t uint32_data; + /* + * -- std_msgs/Uint64 --------------------------- + */ + protobuf_c_boolean has_uint64_data; + uint64_t uint64_data; + /* + * -- std_msgs/Float32MultiArray --------------------------- + */ + size_t n_float32_array_data; + float *float32_array_data; + /* + * -- std_msgs/Float64MultiArray --------------------------- + */ + size_t n_float64_array_data; + double *float64_array_data; + /* + * -- std_msgs/Int32MultiArray --------------------------- + */ + size_t n_int32_array_data; + int32_t *int32_array_data; + /* + * -- std_msgs/Int64MultiArray --------------------------- + */ + size_t n_int64_array_data; + int64_t *int64_array_data; + /* + * -- std_msgs/Uint32MultiArray --------------------------- + */ + size_t n_uint32_array_data; + uint32_t *uint32_array_data; + /* + * -- std_msgs/Uint64MultiArray --------------------------- + */ + size_t n_uint64_array_data; + uint64_t *uint64_array_data; +}; +#define RACS2_BRIDGE_STD_MSGS__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&racs2_bridge_std_msgs__descriptor) \ + , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL, 0,NULL } + + +/* RACS2BridgeStdMsgs methods */ +void racs2_bridge_std_msgs__init + (RACS2BridgeStdMsgs *message); +size_t racs2_bridge_std_msgs__get_packed_size + (const RACS2BridgeStdMsgs *message); +size_t racs2_bridge_std_msgs__pack + (const RACS2BridgeStdMsgs *message, + uint8_t *out); +size_t racs2_bridge_std_msgs__pack_to_buffer + (const RACS2BridgeStdMsgs *message, + ProtobufCBuffer *buffer); +RACS2BridgeStdMsgs * + racs2_bridge_std_msgs__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void racs2_bridge_std_msgs__free_unpacked + (RACS2BridgeStdMsgs *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*RACS2BridgeStdMsgs_Closure) + (const RACS2BridgeStdMsgs *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor racs2_bridge_std_msgs__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_RACS2Brdige_5fstd_5fmsgs_2eproto__INCLUDED */ diff --git a/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/src/racs2_user_msg.h b/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/src/racs2_user_msg.h new file mode 100644 index 00000000..d8ad12f1 --- /dev/null +++ b/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/src/racs2_user_msg.h @@ -0,0 +1,22 @@ +#ifndef _racs2_user_msg_h_ +#define _racs2_user_msg_h_ + +/* +** Type definition (user data format for racs2 bridge) +*/ +#define ROS2_TOPIC_NAME_LNGTH 32 +#define BODY_DATA_MAX_LNGTH 128 + +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + char ros2_topic_name[ROS2_TOPIC_NAME_LNGTH]; + uint8 body_data_length; + uint8 body_data[BODY_DATA_MAX_LNGTH]; + +} OS_PACK racs2_user_msg_t ; + +#define RACS2_USER_MSG_LNGTH sizeof ( racs2_user_msg_t ) +#define RACS2_BRIDGE_USER_LISTENER_LNGTH sizeof ( racs2_user_msg_t ) + +#endif /* _racs2_user_msg_h_ */ diff --git a/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/src/sample_talker.c b/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/src/sample_talker.c new file mode 100644 index 00000000..6c42637c --- /dev/null +++ b/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/src/sample_talker.c @@ -0,0 +1,261 @@ +/* +** Include Files: +*/ +#include "sample_talker.h" +#include "sample_talker_perfids.h" +#include "sample_talker_msgids.h" +#include "sample_talker_msg.h" +#include "racs2_user_msg.h" +#include "sample_talker_events.h" +#include "sample_talker_version.h" +#include "RACS2Brdige_std_msgs.pb-c.h" + +/* +** Global Data +*/ +sample_hk_tlm_t SAMPLE_TALKER_HkTelemetryPkt; +racs2_user_msg_t RACS2_UserMsgPkt; +CFE_SB_PipeId_t SAMPLE_TALKER_CommandPipe; +CFE_SB_MsgPtr_t SAMPLE_TALKER_MsgPtr; + +static CFE_EVS_BinFilter_t SAMPLE_EventFilters[] = { + {SAMPLE_STARTUP_INF_EID, 0x0000}, + {SAMPLE_COMMAND_ERR_EID, 0x0000}, + {SAMPLE_COMMANDNOP_INF_EID, 0x0000}, + {SAMPLE_COMMANDRST_INF_EID, 0x0000}, +}; + +/* +** Name: SAMPLE_TALKER_Main +** +** Purpose: Entry point and main loop of the application. It generates a random +** integer between 0 and 4 and sends it as a message to the ROS2 bridge. +** The process repeats every 5 seconds. +** +*/ +void SAMPLE_TALKER_Main(void) +{ + int32 status; + uint32 RunStatus = CFE_ES_RunStatus_APP_RUN; + int num; + int count = 0; + + OS_printf("SAMPLE_TALKER_Main starts.\n"); + + // Log the performance entry + CFE_ES_PerfLogEntry(SAMPLE_APP_PERF_ID); + + // Initialize the application + SAMPLE_TAKLKER_Init(); + + // Seed the random number generator + srand(time(NULL)); + + /* + ** SAMPLE_TALKER Runloop: Generates a random number and sends messages. + */ + while (CFE_ES_RunLoop(&RunStatus) == true) + { + CFE_ES_PerfLogExit(SAMPLE_APP_PERF_ID); + CFE_ES_PerfLogEntry(SAMPLE_APP_PERF_ID); + + // Generate a random number between 0 and 7 + num = rand() % 8; + + // Set the ROS2 topic name + strcpy(RACS2_UserMsgPkt.ros2_topic_name, "/Recv/RACS2Bridge"); + + // Create the message content + int string_length = 22; + char buf[32]; + sprintf(buf, "Message To ROS2 :%5d", num); + + RACS2BridgeStdMsgs *message = (RACS2BridgeStdMsgs *)malloc(sizeof(RACS2BridgeStdMsgs)); + racs2_bridge_std_msgs__init(message); + + message->string_data = (char *)malloc(string_length); + strncpy(message->string_data, buf, string_length); + + // Serialize the message + int len = racs2_bridge_std_msgs__get_packed_size(message); + void *buffer = malloc(len); + racs2_bridge_std_msgs__pack(message, buffer); + + // Set the body data and length + strncpy(RACS2_UserMsgPkt.body_data, buffer, len); + RACS2_UserMsgPkt.body_data_length = len; + + // Timestamp the message and send it + CFE_SB_TimeStampMsg((CFE_SB_Msg_t *)&RACS2_UserMsgPkt); + status = CFE_SB_SendMsg((CFE_SB_Msg_t *)&RACS2_UserMsgPkt); + + // Check for errors in sending + if (status != CFE_SUCCESS) + { + OS_printf("SAMPLE_TALKER: Error: sending failed. status = 0x%x\n", status); + } + + // Clean up memory + free(buffer); + free(message->string_data); + free(message); + memset(buf, '\0', sizeof(buf)); + + // Wait for 5 seconds before sending the next message + sleep(5); + } + + CFE_ES_ExitApp(RunStatus); +} + +/* +** Name: SAMPLE_TAKLKER_Init +** +** Purpose: Initializes the application by registering it with executive services, +** registering events, resetting counters, and initializing message packets. +** +*/ +void SAMPLE_TAKLKER_Init(void) +{ + // Register the application with Executive services + CFE_ES_RegisterApp(); + + // Register events with event services + CFE_EVS_Register(SAMPLE_EventFilters, + sizeof(SAMPLE_EventFilters) / sizeof(CFE_EVS_BinFilter_t), + CFE_EVS_EventFilter_BINARY); + + // Reset counters + SAMPLE_TALKER_ResetCounters(); + + // Initialize housekeeping and user message packets + CFE_SB_InitMsg(&SAMPLE_TALKER_HkTelemetryPkt, SAMPLE_TALKER_HK_TLM_MID, SAMPLE_APP_HK_TLM_LNGTH, true); + CFE_SB_InitMsg(&RACS2_UserMsgPkt, RACS2_BRIDGE_MID, RACS2_USER_MSG_LNGTH, false); + + // Send startup event + CFE_EVS_SendEvent(SAMPLE_STARTUP_INF_EID, CFE_EVS_EventType_INFORMATION, + "SAMPLE_TALKER App Initialized. Version %d.%d.%d.%d", + SAMPLE_APP_MAJOR_VERSION, + SAMPLE_APP_MINOR_VERSION, + SAMPLE_APP_REVISION, + SAMPLE_APP_MISSION_REV); +} + +/* +** Name: SAMPLE_TALKER_ProcessCommandPacket +** +** Purpose: Processes packets received on the SAMPLE_TALKER command pipe by +** identifying the message ID and directing it to the appropriate handler. +** +*/ +void SAMPLE_TALKER_ProcessCommandPacket(void) +{ + CFE_SB_MsgId_t MsgId; + + MsgId = CFE_SB_GetMsgId(SAMPLE_TALKER_MsgPtr); + + switch (MsgId) + { + case SAMPLE_TALKER_CMD_MID: + SAMPLE_TALKER_ProcessGroundCommand(); + break; + + case SAMPLE_TALKER_SEND_HK_MID: + SAMPLE_TALKER_ReportHousekeeping(); + break; + + default: + SAMPLE_TALKER_HkTelemetryPkt.sample_command_error_count++; + CFE_EVS_SendEvent(SAMPLE_COMMAND_ERR_EID, CFE_EVS_EventType_ERROR, + "SAMPLE_TALKER: invalid command packet,MID = 0x%x", MsgId); + break; + } +} + +/* +** Name: SAMPLE_TALKER_ProcessGroundCommand +** +** Purpose: Processes ground commands such as NOOP and Reset Counters, updating telemetry +** or taking the appropriate action based on the command code. +** +*/ +void SAMPLE_TALKER_ProcessGroundCommand(void) +{ + uint16 CommandCode; + + CommandCode = CFE_SB_GetCmdCode(SAMPLE_TALKER_MsgPtr); + + switch (CommandCode) + { + case SAMPLE_APP_NOOP_CC: + SAMPLE_TALKER_HkTelemetryPkt.sample_command_count++; + CFE_EVS_SendEvent(SAMPLE_COMMANDNOP_INF_EID, CFE_EVS_EventType_INFORMATION, + "SAMPLE_TALKER: NOOP command"); + break; + + case SAMPLE_APP_RESET_COUNTERS_CC: + SAMPLE_TALKER_ResetCounters(); + break; + + default: + break; + } +} + +/* +** Name: SAMPLE_TALKER_ReportHousekeeping +** +** Purpose: Gathers the application's telemetry, packetizes it, and sends it to +** the housekeeping task via the software bus. +** +*/ +void SAMPLE_TALKER_ReportHousekeeping(void) +{ + CFE_SB_TimeStampMsg((CFE_SB_Msg_t *)&SAMPLE_TALKER_HkTelemetryPkt); + CFE_SB_SendMsg((CFE_SB_Msg_t *)&SAMPLE_TALKER_HkTelemetryPkt); +} + +/* +** Name: SAMPLE_TALKER_ResetCounters +** +** Purpose: Resets all global counter variables that are part of the task telemetry. +** +*/ +void SAMPLE_TALKER_ResetCounters(void) +{ + SAMPLE_TALKER_HkTelemetryPkt.sample_command_count = 0; + SAMPLE_TALKER_HkTelemetryPkt.sample_command_error_count = 0; + + CFE_EVS_SendEvent(SAMPLE_COMMANDRST_INF_EID, CFE_EVS_EventType_INFORMATION, + "SAMPLE_TALKER: RESET command"); +} + +/* +** Name: SAMPLE_TALKER_VerifyCmdLength +** +** Purpose: Verifies that the length of a command packet matches the expected length. +** If the lengths do not match, an error event is sent. +** +** Returns: true if lengths match, false otherwise. +** +*/ +bool SAMPLE_TALKER_VerifyCmdLength(CFE_SB_MsgPtr_t msg, uint16 ExpectedLength) +{ + bool result = true; + uint16 ActualLength = CFE_SB_GetTotalMsgLength(msg); + + if (ExpectedLength != ActualLength) + { + CFE_SB_MsgId_t MessageID = CFE_SB_GetMsgId(msg); + uint16 CommandCode = CFE_SB_GetCmdCode(msg); + + CFE_EVS_SendEvent(SAMPLE_LEN_ERR_EID, CFE_EVS_EventType_ERROR, + "Invalid msg length: ID = 0x%X, CC = %d, Len = %d, Expected = %d", + MessageID, CommandCode, ActualLength, ExpectedLength); + result = false; + SAMPLE_TALKER_HkTelemetryPkt.sample_command_error_count++; + } + + return result; +} + diff --git a/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/src/sample_talker.h b/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/src/sample_talker.h new file mode 100644 index 00000000..ea752ab3 --- /dev/null +++ b/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/src/sample_talker.h @@ -0,0 +1,39 @@ +#ifndef _sample_talker_h_ +#define _sample_talker_h_ + +/* +** Required header files. +*/ +#include "cfe.h" +#include "cfe_error.h" +#include "cfe_evs.h" +#include "cfe_sb.h" +#include "cfe_es.h" + +#include +#include +#include +#include +#include +#include +#include + + +#define SAMPLE_PIPE_DEPTH 32 + +/* +** Local function prototypes. +** +** Note: Except for the entry point (SAMPLE_TALKER_Main), these +** functions are not called from any other source module. +*/ +void SAMPLE_TALKER_Main(void); +void SAMPLE_TAKLKER_Init(void); +void SAMPLE_TALKER_ProcessCommandPacket(void); +void SAMPLE_TALKER_ProcessGroundCommand(void); +void SAMPLE_TALKER_ReportHousekeeping(void); +void SAMPLE_TALKER_ResetCounters(void); + +bool SAMPLE_TALKER_VerifyCmdLength(CFE_SB_MsgPtr_t msg, uint16 ExpectedLength); + +#endif /* _sample_talker_h_ */ diff --git a/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/src/sample_talker_events.h b/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/src/sample_talker_events.h new file mode 100644 index 00000000..d068a099 --- /dev/null +++ b/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/src/sample_talker_events.h @@ -0,0 +1,13 @@ +#ifndef _sample_talker_events_h_ +#define _sample_talker_events_h_ + + +#define SAMPLE_RESERVED_EID 20 +#define SAMPLE_STARTUP_INF_EID 21 +#define SAMPLE_COMMAND_ERR_EID 22 +#define SAMPLE_COMMANDNOP_INF_EID 23 +#define SAMPLE_COMMANDRST_INF_EID 24 +#define SAMPLE_INVALID_MSGID_ERR_EID 25 +#define SAMPLE_LEN_ERR_EID 26 + +#endif /* _sample_talker_events_h_ */ diff --git a/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/src/sample_talker_msg.h b/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/src/sample_talker_msg.h new file mode 100644 index 00000000..8adbe994 --- /dev/null +++ b/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/src/sample_talker_msg.h @@ -0,0 +1,36 @@ +#ifndef _sample_talker_msg_h_ +#define _sample_talker_msg_h_ + +/* +** SAMPLE App command codes +*/ +#define SAMPLE_APP_NOOP_CC 0 +#define SAMPLE_APP_RESET_COUNTERS_CC 1 + +/*************************************************************************/ +/* +** Type definition (generic "no arguments" command) +*/ +typedef struct +{ + uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; + +} SAMPLE_NoArgsCmd_t; + +/*************************************************************************/ +/* +** Type definition (SAMPLE App housekeeping) +*/ +typedef struct +{ + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint8 sample_command_error_count; + uint8 sample_command_count; + uint8 spare[2]; + +} OS_PACK sample_hk_tlm_t ; + +#define SAMPLE_APP_HK_TLM_LNGTH sizeof ( sample_hk_tlm_t ) +#define SAMPLE_TALKER_LISTENER_LNGTH sizeof ( sample_hk_tlm_t ) + +#endif /* _sample_talker_msg_h_ */ diff --git a/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/src/sample_talker_version.h b/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/src/sample_talker_version.h new file mode 100644 index 00000000..41115c9d --- /dev/null +++ b/jaxa_integration/cFS_app_examples/space_robots/cfs_app/sample_talker/fsw/src/sample_talker_version.h @@ -0,0 +1,9 @@ +#ifndef _sample_talker_version_h_ +#define _sample_talker_version_h_ + +#define SAMPLE_APP_MAJOR_VERSION 1 +#define SAMPLE_APP_MINOR_VERSION 1 +#define SAMPLE_APP_REVISION 0 +#define SAMPLE_APP_MISSION_REV 0 + +#endif /* _sample_talker_version_h_ */ diff --git a/jaxa_integration/images/architecture.png b/jaxa_integration/images/architecture.png new file mode 100644 index 00000000..26df58dd Binary files /dev/null and b/jaxa_integration/images/architecture.png differ diff --git a/jaxa_integration/jaxa_comm_spaceros/jaxa_comm_spaceros/RACS2Bridge_std_msgs_pb2.py b/jaxa_integration/jaxa_comm_spaceros/jaxa_comm_spaceros/RACS2Bridge_std_msgs_pb2.py new file mode 100644 index 00000000..dd567e91 --- /dev/null +++ b/jaxa_integration/jaxa_comm_spaceros/jaxa_comm_spaceros/RACS2Bridge_std_msgs_pb2.py @@ -0,0 +1,166 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: RACS2Bridge_std_msgs.proto + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='RACS2Bridge_std_msgs.proto', + package='', + syntax='proto2', + serialized_options=None, + serialized_pb=_b('\n\x1aRACS2Bridge_std_msgs.proto\"\xf3\x02\n\x14RACS2Bridge_std_msgs\x12\x11\n\tbool_data\x18\x01 \x01(\x08\x12\x12\n\nfloat_data\x18\x02 \x01(\x02\x12\x13\n\x0b\x64ouble_data\x18\x03 \x01(\x01\x12\x12\n\nint32_data\x18\x04 \x01(\x05\x12\x12\n\nint64_data\x18\x05 \x01(\x03\x12\x13\n\x0bstring_data\x18\x06 \x01(\t\x12\x13\n\x0buint32_data\x18\x07 \x01(\r\x12\x13\n\x0buint64_data\x18\x08 \x01(\x04\x12\x1e\n\x12\x66loat32_array_data\x18\t \x03(\x02\x42\x02\x10\x01\x12\x1e\n\x12\x66loat64_array_data\x18\n \x03(\x01\x42\x02\x10\x01\x12\x1c\n\x10int32_array_data\x18\x0b \x03(\x05\x42\x02\x10\x01\x12\x1c\n\x10int64_array_data\x18\x0c \x03(\x03\x42\x02\x10\x01\x12\x1d\n\x11uint32_array_data\x18\r \x03(\rB\x02\x10\x01\x12\x1d\n\x11uint64_array_data\x18\x0e \x03(\x04\x42\x02\x10\x01') +) + + + + +_RACS2BRIDGE_STD_MSGS = _descriptor.Descriptor( + name='RACS2Bridge_std_msgs', + full_name='RACS2Bridge_std_msgs', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='bool_data', full_name='RACS2Bridge_std_msgs.bool_data', index=0, + number=1, type=8, cpp_type=7, label=1, + has_default_value=False, default_value=False, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='float_data', full_name='RACS2Bridge_std_msgs.float_data', index=1, + number=2, type=2, cpp_type=6, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='double_data', full_name='RACS2Bridge_std_msgs.double_data', index=2, + number=3, type=1, cpp_type=5, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='int32_data', full_name='RACS2Bridge_std_msgs.int32_data', index=3, + number=4, type=5, cpp_type=1, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='int64_data', full_name='RACS2Bridge_std_msgs.int64_data', index=4, + number=5, type=3, cpp_type=2, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='string_data', full_name='RACS2Bridge_std_msgs.string_data', index=5, + number=6, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='uint32_data', full_name='RACS2Bridge_std_msgs.uint32_data', index=6, + number=7, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='uint64_data', full_name='RACS2Bridge_std_msgs.uint64_data', index=7, + number=8, type=4, cpp_type=4, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='float32_array_data', full_name='RACS2Bridge_std_msgs.float32_array_data', index=8, + number=9, type=2, cpp_type=6, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=_b('\020\001'), file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='float64_array_data', full_name='RACS2Bridge_std_msgs.float64_array_data', index=9, + number=10, type=1, cpp_type=5, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=_b('\020\001'), file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='int32_array_data', full_name='RACS2Bridge_std_msgs.int32_array_data', index=10, + number=11, type=5, cpp_type=1, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=_b('\020\001'), file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='int64_array_data', full_name='RACS2Bridge_std_msgs.int64_array_data', index=11, + number=12, type=3, cpp_type=2, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=_b('\020\001'), file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='uint32_array_data', full_name='RACS2Bridge_std_msgs.uint32_array_data', index=12, + number=13, type=13, cpp_type=3, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=_b('\020\001'), file=DESCRIPTOR), + _descriptor.FieldDescriptor( + name='uint64_array_data', full_name='RACS2Bridge_std_msgs.uint64_array_data', index=13, + number=14, type=4, cpp_type=4, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=_b('\020\001'), file=DESCRIPTOR), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto2', + extension_ranges=[], + oneofs=[ + ], + serialized_start=31, + serialized_end=402, +) + +DESCRIPTOR.message_types_by_name['RACS2Bridge_std_msgs'] = _RACS2BRIDGE_STD_MSGS +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +RACS2Bridge_std_msgs = _reflection.GeneratedProtocolMessageType('RACS2Bridge_std_msgs', (_message.Message,), dict( + DESCRIPTOR = _RACS2BRIDGE_STD_MSGS, + __module__ = 'RACS2Bridge_std_msgs_pb2' + # @@protoc_insertion_point(class_scope:RACS2Bridge_std_msgs) + )) +_sym_db.RegisterMessage(RACS2Bridge_std_msgs) + + +_RACS2BRIDGE_STD_MSGS.fields_by_name['float32_array_data']._options = None +_RACS2BRIDGE_STD_MSGS.fields_by_name['float64_array_data']._options = None +_RACS2BRIDGE_STD_MSGS.fields_by_name['int32_array_data']._options = None +_RACS2BRIDGE_STD_MSGS.fields_by_name['int64_array_data']._options = None +_RACS2BRIDGE_STD_MSGS.fields_by_name['uint32_array_data']._options = None +_RACS2BRIDGE_STD_MSGS.fields_by_name['uint64_array_data']._options = None +# @@protoc_insertion_point(module_scope) diff --git a/jaxa_integration/jaxa_comm_spaceros/jaxa_comm_spaceros/__init__.py b/jaxa_integration/jaxa_comm_spaceros/jaxa_comm_spaceros/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/jaxa_integration/jaxa_comm_spaceros/jaxa_comm_spaceros/jaxa_canadarm_listener.py b/jaxa_integration/jaxa_comm_spaceros/jaxa_comm_spaceros/jaxa_canadarm_listener.py new file mode 100644 index 00000000..e43499a8 --- /dev/null +++ b/jaxa_integration/jaxa_comm_spaceros/jaxa_comm_spaceros/jaxa_canadarm_listener.py @@ -0,0 +1,117 @@ +import rclpy +from rclpy.node import Node +from racs2_msg.msg import RACS2UserMsg +from jaxa_comm_spaceros.RACS2Bridge_std_msgs_pb2 import RACS2Bridge_std_msgs +from std_srvs.srv import Empty +import re + +class CanadarmListener(Node): + """ + A ROS 2 subscriber node for controlling the Canadarm. + + This node listens on the '/Recv/RACS2Bridge' topic and processes + incoming `RACS2UserMsg` messages. Based on the message content, + it calls the appropriate ROS 2 services to control the Canadarm. + """ + + def __init__(self): + """Initialize the CanadarmListener node and set up the subscription.""" + super().__init__('canadarm_listener') + + # Create a dictionary of service clients + self.clients_dict = { + 'open_arm': self.create_client(Empty, '/open_arm'), + 'close_arm': self.create_client(Empty, '/close_arm'), + 'random_arm': self.create_client(Empty, '/random_arm') + } + + # Set up subscription + self.subscription = self.create_subscription( + RACS2UserMsg, + '/Recv/RACS2Bridge', + self.listener_callback, + 10 + ) + + def listener_callback(self, msg): + """ + Callback function executed upon receiving a message. + + Args: + msg (RACS2UserMsg): The message received from the subscribed topic. + """ + self.get_logger().info('Received message on /Recv/RACS2Bridge') + + # Initialize the message object + message = RACS2Bridge_std_msgs() + message.ParseFromString(b''.join(msg.body_data)) + + # Check if the parsed message contains string data + if message.HasField("string_data"): + command = int(message.string_data.split()[-1]) + self.get_logger().info(f'Received command: {command}') + # Determine which service to call based on the command + service_name = self.get_service_name(command) + if service_name: + self.get_logger().info(f'Calling service: {service_name}') + self.call_service_async(self.clients_dict[service_name]) + else: + self.get_logger().warning(f'Unknown command: {command}') + + def get_service_name(self, command): + """Return the service name based on the command.""" + service_map = { + 0: 'close_arm', + 1: 'open_arm', + 2: 'random_arm', + } + return service_map.get(command, None) + + def call_service_async(self, client): + """ + Initiates an asynchronous service call and registers a callback to handle the result. + + Args: + client (rclpy.client.Client): The ROS 2 service client to call. + """ + if not client.service_is_ready(): + self.get_logger().info(f'Waiting for service {client.srv_name} to be available...') + client.wait_for_service() + + future = client.call_async(Empty.Request()) + future.add_done_callback(self.service_response_callback) + + def service_response_callback(self, future): + """ + Callback function to handle the result of an asynchronous service call. + + Args: + future (rclpy.future.Future): The future representing the result of the service call. + """ + try: + result = future.result() + self.get_logger().info('Service call successful.') + except Exception as e: + self.get_logger().error(f'Exception during service call: {e}') + + +def main(args=None): + """ + Main function to run the CanadarmListener node. + + Initializes the ROS 2 client library, spins the node, and handles node shutdown. + """ + rclpy.init(args=args) + + # Create and spin the CanadarmListener node + canadarm_listener = CanadarmListener() + rclpy.spin(canadarm_listener) + + # Destroy the node explicitly before shutting down + canadarm_listener.destroy_node() + rclpy.shutdown() + + +if __name__ == '__main__': + main() + diff --git a/jaxa_integration/jaxa_comm_spaceros/jaxa_comm_spaceros/jaxa_rover_listener.py b/jaxa_integration/jaxa_comm_spaceros/jaxa_comm_spaceros/jaxa_rover_listener.py new file mode 100644 index 00000000..b57bf5fe --- /dev/null +++ b/jaxa_integration/jaxa_comm_spaceros/jaxa_comm_spaceros/jaxa_rover_listener.py @@ -0,0 +1,98 @@ +import rclpy +from rclpy.node import Node +from racs2_msg.msg import RACS2UserMsg +from jaxa_comm_spaceros.RACS2Bridge_std_msgs_pb2 import RACS2Bridge_std_msgs +from std_srvs.srv import Empty + +class JaxaRoverListener(Node): + def __init__(self): + super().__init__('jaxa_rover_listener') + + # Create service clients + self.clients_dict = { + 'move_stop': self.create_client(Empty, '/move_stop'), + 'move_forward': self.create_client(Empty, '/move_forward'), + 'turn_left': self.create_client(Empty, '/turn_left'), + 'turn_right': self.create_client(Empty, '/turn_right'), + 'open_arm': self.create_client(Empty, '/open_arm'), + 'close_arm': self.create_client(Empty, '/close_arm'), + 'mast_open': self.create_client(Empty, '/mast_open'), + 'mast_close': self.create_client(Empty, '/mast_close') + } + + # Set up subscription + self.subscription = self.create_subscription( + RACS2UserMsg, + '/Recv/RACS2Bridge', + self.listener_callback, + 10 + ) + + def listener_callback(self, msg): + self.get_logger().info('Subscribing: [/Recv/RACS2Bridge]') + + # Initialize the message object + message = RACS2Bridge_std_msgs() + message.ParseFromString(b''.join(msg.body_data)) + + if message.HasField("string_data"): + command = int(message.string_data.split()[-1]) + self.get_logger().info(f'Received command: {command}') + + service_name = self.get_service_name(command) + if service_name: + self.get_logger().info(f'Calling service: {service_name}') + self.call_service_async(self.clients_dict[service_name]) + else: + self.get_logger().warning(f'Unknown command: {command}') + + def get_service_name(self, command): + service_map = { + 0: 'move_stop', + 1: 'move_forward', + 2: 'turn_left', + 3: 'turn_right', + 4: 'open_arm', + 5: 'close_arm', + 6: 'mast_open', + 7: 'mast_close' + } + return service_map.get(command, None) + + def call_service_async(self, client): + """ + Initiates an asynchronous service call and registers a callback to handle the result. + + Args: + client (rclpy.client.Client): The ROS 2 service client to call. + """ + if not client.service_is_ready(): + self.get_logger().info(f'Waiting for service {client.service_name} to be available...') + client.wait_for_service() + + future = client.call_async(Empty.Request()) + future.add_done_callback(self.service_response_callback) + + def service_response_callback(self, future): + """ + Callback function to handle the result of an asynchronous service call. + + Args: + future (rclpy.future.Future): The future representing the result of the service call. + """ + try: + result = future.result() + self.get_logger().info('Service call successful.') + except Exception as e: + self.get_logger().error(f'Exception during service call: {e}') + +def main(args=None): + rclpy.init(args=args) + jaxa_rover_listener = JaxaRoverListener() + rclpy.spin(jaxa_rover_listener) + jaxa_rover_listener.destroy_node() + rclpy.shutdown() + +if __name__ == '__main__': + main() + diff --git a/jaxa_integration/jaxa_comm_spaceros/jaxa_comm_spaceros/jaxa_simple_listener.py b/jaxa_integration/jaxa_comm_spaceros/jaxa_comm_spaceros/jaxa_simple_listener.py new file mode 100644 index 00000000..3d8e9291 --- /dev/null +++ b/jaxa_integration/jaxa_comm_spaceros/jaxa_comm_spaceros/jaxa_simple_listener.py @@ -0,0 +1,92 @@ +""" +JAXA Simple Listener Node + +This ROS 2 node subscribes to messages from the JAXA RACS2 bridge and processes +incoming data. + +Author: Minahil Raza +Email: minahilrz@gmail.com + +This script subscribes to the '/Recv/RACS2Bridge' topic, receives messages +of type `RACS2UserMsg`, parses the message content, and logs any string data +that is extracted. + +Usage: + This script is intended to be run within a ROS 2 environment. It should be + included in a ROS 2 package and can be launched using the `ros2 run` command + or through a ROS 2 launch file. + +""" + +import rclpy +from rclpy.node import Node +from racs2_msg.msg import RACS2UserMsg +from jaxa_comm_spaceros.RACS2Bridge_std_msgs_pb2 import RACS2Bridge_std_msgs + + +class JaxaSimpleListener(Node): + """ + A simple ROS 2 subscriber node for receiving and processing messages + from the JAXA RACS2 bridge. + + This node listens on the '/Recv/RACS2Bridge' topic and processes + incoming `RACS2UserMsg` messages. It extracts and logs any string + data contained within the messages. + """ + + def __init__(self): + """Initialize the JaxaSimpleListener node and set up the subscription.""" + super().__init__('jaxa_simple_listener') + self.subscription = self.create_subscription( + RACS2UserMsg, + '/Recv/RACS2Bridge', + self.listener_callback, + 10 + ) + # Prevent unused variable warning + self.subscription + + def listener_callback(self, msg): + """ + Callback function executed upon receiving a message. + + Parses the incoming `RACS2UserMsg` message to extract string data + and logs it. + + Args: + msg (RACS2UserMsg): The message received from the subscribed topic. + """ + self.get_logger().info('Subscribing: [/Recv/RACS2Bridge]') + + # Initialize the message object + message = RACS2Bridge_std_msgs() + + # Parse the incoming message body data + message.ParseFromString(b''.join(msg.body_data)) + + # Check if the parsed message contains string data and log it + if message.HasField("string_data"): + self.get_logger().info(f'Received string data: {message.string_data}') + + +def main(args=None): + """ + Main function to run the JaxaSimpleListener node. + + Initializes the ROS 2 client library, spins the node, and handles node shutdown. + """ + + rclpy.init(args=args) + + # Create and spin the JaxaSimpleListener node + jaxa_simple_listener = JaxaSimpleListener() + rclpy.spin(jaxa_simple_listener) + + # Destroy the node explicitly before shutting down + jaxa_simple_listener.destroy_node() + rclpy.shutdown() + + +if __name__ == '__main__': + main() + diff --git a/jaxa_integration/jaxa_comm_spaceros/package.xml b/jaxa_integration/jaxa_comm_spaceros/package.xml new file mode 100644 index 00000000..5e9674f0 --- /dev/null +++ b/jaxa_integration/jaxa_comm_spaceros/package.xml @@ -0,0 +1,18 @@ + + + + jaxa_comm_spaceros + 0.0.0 + Ros2 Package for communication between JAXA RACS2 Bridge and SpaceROS + spaceros-user + TODO: License declaration + + ament_copyright + ament_flake8 + ament_pep257 + python3-pytest + + + ament_python + + diff --git a/jaxa_integration/jaxa_comm_spaceros/resource/jaxa_comm_spaceros b/jaxa_integration/jaxa_comm_spaceros/resource/jaxa_comm_spaceros new file mode 100644 index 00000000..e69de29b diff --git a/jaxa_integration/jaxa_comm_spaceros/setup.cfg b/jaxa_integration/jaxa_comm_spaceros/setup.cfg new file mode 100644 index 00000000..7a116707 --- /dev/null +++ b/jaxa_integration/jaxa_comm_spaceros/setup.cfg @@ -0,0 +1,4 @@ +[develop] +script_dir=$base/lib/jaxa_comm_spaceros +[install] +install_scripts=$base/lib/jaxa_comm_spaceros diff --git a/jaxa_integration/jaxa_comm_spaceros/setup.py b/jaxa_integration/jaxa_comm_spaceros/setup.py new file mode 100644 index 00000000..e21a51a2 --- /dev/null +++ b/jaxa_integration/jaxa_comm_spaceros/setup.py @@ -0,0 +1,28 @@ +from setuptools import find_packages, setup + +package_name = 'jaxa_comm_spaceros' + +setup( + name=package_name, + version='0.0.0', + packages=find_packages(exclude=['test']), + data_files=[ + ('share/ament_index/resource_index/packages', + ['resource/' + package_name]), + ('share/' + package_name, ['package.xml']), + ], + install_requires=['setuptools'], + zip_safe=True, + maintainer='Minahil Raza', + maintainer_email='minahilrz@gmail.com', + description='A package containing ROS nodes for communicating with JAXA cFS bridge', + license='Apache-2.0 license', + tests_require=['pytest'], + entry_points={ + 'console_scripts': [ + 'jaxa_simple_listener = jaxa_comm_spaceros.jaxa_simple_listener:main', + 'jaxa_rover_listener = jaxa_comm_spaceros.jaxa_rover_listener:main', + 'jaxa_canadarm_listener = jaxa_comm_spaceros.jaxa_canadarm_listener:main' + ], + }, +) diff --git a/jaxa_integration/jaxa_comm_spaceros/test/test_copyright.py b/jaxa_integration/jaxa_comm_spaceros/test/test_copyright.py new file mode 100644 index 00000000..97a39196 --- /dev/null +++ b/jaxa_integration/jaxa_comm_spaceros/test/test_copyright.py @@ -0,0 +1,25 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_copyright.main import main +import pytest + + +# Remove the `skip` decorator once the source file(s) have a copyright header +@pytest.mark.skip(reason='No copyright header has been placed in the generated source file.') +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found errors' diff --git a/jaxa_integration/jaxa_comm_spaceros/test/test_flake8.py b/jaxa_integration/jaxa_comm_spaceros/test/test_flake8.py new file mode 100644 index 00000000..27ee1078 --- /dev/null +++ b/jaxa_integration/jaxa_comm_spaceros/test/test_flake8.py @@ -0,0 +1,25 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_flake8.main import main_with_errors +import pytest + + +@pytest.mark.flake8 +@pytest.mark.linter +def test_flake8(): + rc, errors = main_with_errors(argv=[]) + assert rc == 0, \ + 'Found %d code style errors / warnings:\n' % len(errors) + \ + '\n'.join(errors) diff --git a/jaxa_integration/jaxa_comm_spaceros/test/test_pep257.py b/jaxa_integration/jaxa_comm_spaceros/test/test_pep257.py new file mode 100644 index 00000000..b234a384 --- /dev/null +++ b/jaxa_integration/jaxa_comm_spaceros/test/test_pep257.py @@ -0,0 +1,23 @@ +# Copyright 2015 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_pep257.main import main +import pytest + + +@pytest.mark.linter +@pytest.mark.pep257 +def test_pep257(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found code style errors / warnings' diff --git a/jaxa_integration/racs2_msg/CMakeLists.txt b/jaxa_integration/racs2_msg/CMakeLists.txt new file mode 100644 index 00000000..8c571bc5 --- /dev/null +++ b/jaxa_integration/racs2_msg/CMakeLists.txt @@ -0,0 +1,38 @@ +cmake_minimum_required(VERSION 3.5) +project(racs2_msg) + +# Default to C99 +if(NOT CMAKE_C_STANDARD) + set(CMAKE_C_STANDARD 99) +endif() + +# Default to C++14 +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +endif() + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# find dependencies +find_package(ament_cmake REQUIRED) +find_package(rosidl_default_generators REQUIRED) + +rosidl_generate_interfaces(${PROJECT_NAME} + "msg/RACS2UserMsg.msg" +) + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + # the following line skips the linter which checks for copyrights + # uncomment the line when a copyright and license is not present in all source files + #set(ament_cmake_copyright_FOUND TRUE) + # the following line skips cpplint (only works in a git repo) + # uncomment the line when this package is not in a git repo + #set(ament_cmake_cpplint_FOUND TRUE) + ament_lint_auto_find_test_dependencies() +endif() + +ament_export_dependencies(rosidl_default_runtime) +ament_package() diff --git a/jaxa_integration/racs2_msg/msg/RACS2UserMsg.msg b/jaxa_integration/racs2_msg/msg/RACS2UserMsg.msg new file mode 100644 index 00000000..f6dc1401 --- /dev/null +++ b/jaxa_integration/racs2_msg/msg/RACS2UserMsg.msg @@ -0,0 +1,11 @@ +# +# User data format for ROS2 app in using RACS2 Bridge +# +# --- Header data --- +uint32 cfs_message_id # Message ID of cFS desitnation app +uint32 body_data_length # Body data size in byte +# --- Body data (serializied data is preffered): array of byte --- +# Note: +# - In Python: "byte" means bytes object +# - In C++ : "byte" means uint8_t type +byte[] body_data \ No newline at end of file diff --git a/jaxa_integration/racs2_msg/package.xml b/jaxa_integration/racs2_msg/package.xml new file mode 100644 index 00000000..26ba35d3 --- /dev/null +++ b/jaxa_integration/racs2_msg/package.xml @@ -0,0 +1,22 @@ + + + + racs2_msg + 0.0.0 + RACS2 bridge message package + jaxa + Apache License 2.0 + + ament_cmake + + ament_lint_auto + ament_lint_common + + rosidl_default_generators + rosidl_default_runtime + rosidl_interface_packages + + + ament_cmake + + diff --git a/jaxa_integration/run_jaxa_spaceros_cfs.sh b/jaxa_integration/run_jaxa_spaceros_cfs.sh new file mode 100755 index 00000000..02d47d58 --- /dev/null +++ b/jaxa_integration/run_jaxa_spaceros_cfs.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + + +CONTAINER_NAME=jaxa_spaceros_cfs +IMG_NAME=jaxa_spaceros_cfs + +# Start the container +docker run --rm -it --name $CONTAINER_NAME --network host \ + -e DISPLAY -e TERM -e QT_X11_NO_MITSHM=1 $IMG_NAME + diff --git a/jaxa_integration/run_jaxa_spaceros_listener.sh b/jaxa_integration/run_jaxa_spaceros_listener.sh new file mode 100755 index 00000000..acca159f --- /dev/null +++ b/jaxa_integration/run_jaxa_spaceros_listener.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + + +CONTAINER_NAME=jaxa_spaceros_listener +IMG_NAME=jaxa_spaceros_listener + +# Start the container +docker run --rm -it --name $CONTAINER_NAME --network host \ + -e DISPLAY -e TERM -e QT_X11_NO_MITSHM=1 $IMG_NAME +