From f0cc29fcd63fa091b7b0977e51ff94c01bd21798 Mon Sep 17 00:00:00 2001 From: John Daktylidis Date: Fri, 21 Jul 2023 17:06:52 +0200 Subject: [PATCH] Modified Type Size convention The RTPS Payload size overhead was defined in the rtps_package, and is to be used by all type packages to calculate the MAX__SIZE. The service overhead size was also renamed to ROS_SERVICE_OVERHEAD_BYTES to make the connection with ROS clearer. --- .../Level_2/L2_Testbench_Lib2_config.vhd | 12 +++---- .../Level_2/L2_Testbench_Lib3_config.vhd | 12 +++---- .../Level_2/L2_Testbench_Lib4_config.vhd | 14 ++++---- .../Level_2/L2_Testbench_Lib5_config.vhd | 14 ++++---- src/Tests/Type1_package.vhd | 5 +-- src/Tests/Type2_package.vhd | 3 +- src/ros2/ROS_IDL.txt | 36 +++++++++---------- .../example_interfaces/AddTwoInts_package.vhd | 5 +-- .../example_interfaces/Fibonacci_package.vhd | 7 ++-- .../action_msgs/CancelGoal_package.vhd | 4 +-- .../action_msgs/GoalInfo_package.vhd | 2 +- .../action_msgs/GoalStatusArray_package.vhd | 3 +- .../action_msgs/GoalStatus_package.vhd | 4 +-- src/ros2/ros_package.vhd | 2 +- src/rtps_package.vhd | 5 ++- 15 files changed, 65 insertions(+), 63 deletions(-) diff --git a/src/Tests/Level_2/L2_Testbench_Lib2_config.vhd b/src/Tests/Level_2/L2_Testbench_Lib2_config.vhd index 80903d4..d27aca7 100644 --- a/src/Tests/Level_2/L2_Testbench_Lib2_config.vhd +++ b/src/Tests/Level_2/L2_Testbench_Lib2_config.vhd @@ -29,16 +29,16 @@ package user_config is constant NUM_ENDPOINTS : natural := NUM_READERS+NUM_WRITERS; -- PB Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) constant PORT_CONFIG_PB : natural := 7400; - -- DG Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) + -- DG Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) constant PORT_CONFIG_DG : natural := 250; -- PG Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) - constant PORT_CONFIG_PG : natural := 2; + constant PORT_CONFIG_PG : natural := 2; -- D0 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) - constant PORT_CONFIG_D0 : natural := 0; + constant PORT_CONFIG_D0 : natural := 0; -- D1 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) constant PORT_CONFIG_D1 : natural := 10; - -- D2 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) - constant PORT_CONFIG_D2 : natural := 1; + -- D2 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) + constant PORT_CONFIG_D2 : natural := 1; -- D3 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) constant PORT_CONFIG_D3 : natural := 11; -- MAC Address of underlying network stack (Used to generate GUIDs) @@ -89,7 +89,7 @@ package body user_config is c.RELIABILITY_QOS := RELIABLE_RELIABILITY_QOS; c.MAX_SAMPLES := std_logic_vector(to_unsigned(5, CDR_LONG_WIDTH)); c.MAX_INSTANCES := std_logic_vector(to_unsigned(5, CDR_LONG_WIDTH)); - c.MAX_PAYLOAD_SIZE := MAX_TYPE1_SIZE + 4; -- (+ PAYLOAD HEADER) + c.MAX_PAYLOAD_SIZE := MAX_TYPE1_SIZE; ret := (others => c); diff --git a/src/Tests/Level_2/L2_Testbench_Lib3_config.vhd b/src/Tests/Level_2/L2_Testbench_Lib3_config.vhd index a362c8b..495f418 100644 --- a/src/Tests/Level_2/L2_Testbench_Lib3_config.vhd +++ b/src/Tests/Level_2/L2_Testbench_Lib3_config.vhd @@ -29,16 +29,16 @@ package user_config is constant NUM_ENDPOINTS : natural := NUM_READERS+NUM_WRITERS; -- PB Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) constant PORT_CONFIG_PB : natural := 7400; - -- DG Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) + -- DG Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) constant PORT_CONFIG_DG : natural := 250; -- PG Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) - constant PORT_CONFIG_PG : natural := 2; + constant PORT_CONFIG_PG : natural := 2; -- D0 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) - constant PORT_CONFIG_D0 : natural := 0; + constant PORT_CONFIG_D0 : natural := 0; -- D1 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) constant PORT_CONFIG_D1 : natural := 10; - -- D2 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) - constant PORT_CONFIG_D2 : natural := 1; + -- D2 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) + constant PORT_CONFIG_D2 : natural := 1; -- D3 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) constant PORT_CONFIG_D3 : natural := 11; -- MAC Address of underlying network stack (Used to generate GUIDs) @@ -89,7 +89,7 @@ package body user_config is c.RELIABILITY_QOS := RELIABLE_RELIABILITY_QOS; c.MAX_SAMPLES := std_logic_vector(to_unsigned(5, CDR_LONG_WIDTH)); c.MAX_INSTANCES := std_logic_vector(to_unsigned(5, CDR_LONG_WIDTH)); - c.MAX_PAYLOAD_SIZE := MAX_TYPE1_SIZE + 4; -- (+ PAYLOAD HEADER) + c.MAX_PAYLOAD_SIZE := MAX_TYPE1_SIZE; ret := (others => c); diff --git a/src/Tests/Level_2/L2_Testbench_Lib4_config.vhd b/src/Tests/Level_2/L2_Testbench_Lib4_config.vhd index 6d5700f..35f4867 100644 --- a/src/Tests/Level_2/L2_Testbench_Lib4_config.vhd +++ b/src/Tests/Level_2/L2_Testbench_Lib4_config.vhd @@ -24,21 +24,21 @@ package user_config is -- Number of RTPS Writer Endpoints constant NUM_WRITERS : natural := 1; -- Number of RTPS Reader Endpoints - constant NUM_READERS : natural := 1; + constant NUM_READERS : natural := 1; -- Number of RTPS Endpoints (Do not modify) constant NUM_ENDPOINTS : natural := NUM_READERS+NUM_WRITERS; -- PB Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) constant PORT_CONFIG_PB : natural := 7400; - -- DG Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) + -- DG Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) constant PORT_CONFIG_DG : natural := 250; -- PG Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) - constant PORT_CONFIG_PG : natural := 2; + constant PORT_CONFIG_PG : natural := 2; -- D0 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) - constant PORT_CONFIG_D0 : natural := 0; + constant PORT_CONFIG_D0 : natural := 0; -- D1 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) constant PORT_CONFIG_D1 : natural := 10; - -- D2 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) - constant PORT_CONFIG_D2 : natural := 1; + -- D2 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) + constant PORT_CONFIG_D2 : natural := 1; -- D3 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) constant PORT_CONFIG_D3 : natural := 11; -- MAC Address of underlying network stack (Used to generate GUIDs) @@ -90,7 +90,7 @@ package body user_config is c.HISTORY_DEPTH := std_logic_vector(to_unsigned(5, CDR_LONG_WIDTH)); c.MAX_SAMPLES := std_logic_vector(to_unsigned(20, CDR_LONG_WIDTH)); c.MAX_INSTANCES := std_logic_vector(to_unsigned(5, CDR_LONG_WIDTH)); - c.MAX_PAYLOAD_SIZE := MAX_TYPE1_SIZE + 4; -- (+ PAYLOAD HEADER) + c.MAX_PAYLOAD_SIZE := MAX_TYPE1_SIZE; ret := (others => c); diff --git a/src/Tests/Level_2/L2_Testbench_Lib5_config.vhd b/src/Tests/Level_2/L2_Testbench_Lib5_config.vhd index b9ef178..369bd35 100644 --- a/src/Tests/Level_2/L2_Testbench_Lib5_config.vhd +++ b/src/Tests/Level_2/L2_Testbench_Lib5_config.vhd @@ -24,21 +24,21 @@ package user_config is -- Number of RTPS Writer Endpoints constant NUM_WRITERS : natural := 1; -- Number of RTPS Reader Endpoints - constant NUM_READERS : natural := 1; + constant NUM_READERS : natural := 1; -- Number of RTPS Endpoints (Do not modify) constant NUM_ENDPOINTS : natural := NUM_READERS+NUM_WRITERS; -- PB Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) constant PORT_CONFIG_PB : natural := 7400; - -- DG Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) + -- DG Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) constant PORT_CONFIG_DG : natural := 250; -- PG Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) - constant PORT_CONFIG_PG : natural := 2; + constant PORT_CONFIG_PG : natural := 2; -- D0 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) - constant PORT_CONFIG_D0 : natural := 0; + constant PORT_CONFIG_D0 : natural := 0; -- D1 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) constant PORT_CONFIG_D1 : natural := 10; - -- D2 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) - constant PORT_CONFIG_D2 : natural := 1; + -- D2 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) + constant PORT_CONFIG_D2 : natural := 1; -- D3 Value of Default Port Generation (see DDSI-RTPS 2.3 Section 9.6.1) constant PORT_CONFIG_D3 : natural := 11; -- MAC Address of underlying network stack (Used to generate GUIDs) @@ -90,7 +90,7 @@ package body user_config is c.HISTORY_DEPTH := std_logic_vector(to_unsigned(5, CDR_LONG_WIDTH)); c.MAX_SAMPLES := std_logic_vector(to_unsigned(20, CDR_LONG_WIDTH)); c.MAX_INSTANCES := std_logic_vector(to_unsigned(5, CDR_LONG_WIDTH)); - c.MAX_PAYLOAD_SIZE := MAX_TYPE1_SIZE + 4; -- (+ PAYLOAD HEADER) + c.MAX_PAYLOAD_SIZE := MAX_TYPE1_SIZE; ret := (others => c); diff --git a/src/Tests/Type1_package.vhd b/src/Tests/Type1_package.vhd index 5ac2b74..718e0a4 100644 --- a/src/Tests/Type1_package.vhd +++ b/src/Tests/Type1_package.vhd @@ -7,12 +7,9 @@ use work.rtps_package.all; package Type1_package is - - constant MAX_ID_SIZE : natural := 4; constant MAX_A_SIZE : natural := 4; -- 8 - constant MAX_TYPE1_SIZE : natural := 8; - constant MAX_TYPE1_KEY_HOLDER_SIZE : natural := 4; + constant MAX_TYPE1_SIZE : natural := 8 + RTPS_PAYLOAD_HEADER_SIZE; end package; \ No newline at end of file diff --git a/src/Tests/Type2_package.vhd b/src/Tests/Type2_package.vhd index fda9ee4..9d4725d 100644 --- a/src/Tests/Type2_package.vhd +++ b/src/Tests/Type2_package.vhd @@ -45,8 +45,7 @@ package Type2_package is constant MAX_TESTUNION_SIZE : natural := 7; -- 180 constant MAX_TESTBITMASK_SIZE : natural := 4; -- 184 constant MAX_TESTSTRING_SIZE : natural := 17; -- 201 - constant MAX_TYPE2_SIZE : natural := 201; - constant MAX_TYPE2_KEY_HOLDER_SIZE : natural := 28; + constant MAX_TYPE2_SIZE : natural := 201 + RTPS_PAYLOAD_HEADER_SIZE; end package; \ No newline at end of file diff --git a/src/ros2/ROS_IDL.txt b/src/ros2/ROS_IDL.txt index 6f95c6a..87db598 100644 --- a/src/ros2/ROS_IDL.txt +++ b/src/ros2/ROS_IDL.txt @@ -6,7 +6,7 @@ GENERAL The wrapper Entities that define and implement the ROS Publisher and Subscriber - named _ros_pub and _ros_sub - are basically carbon copies of a normal _reader_interface and -_writer_interface, with the exception of hiding all the user facing DDS signals and being +_writer_interface, with the exception of hiding all the user facing DDS signals and being responsible for interacting with the DDS entity directly. All these changes are static for all ROS messages, and the actual message dependent VHDL generation is the same, as the RTPS IDL interface generation. @@ -21,20 +21,20 @@ The Service VHDL generation closely follows the general RTPS IDL interface gener For each Service (i.e. .srv File) two files are generated, a server (called _ros_srv_server) and a client (called _ros_srv_client) file. Each file contains both encoding and decoding functionality (similar to the key_holder entities). -The files also contain extra logic that may be necessary to parse the SERVICE_OVERHEAD_BYTES that may be +The files also contain extra logic that may be necessary to parse the ROS_SERVICE_OVERHEAD_BYTES that may be present in the payload. The code generation follows the normal code generation for encoding and decoding with following changes: * Encoding and Decoding stages get a "RQ_" or "RR_" prefixed to the to differentiate between Request and Response message members, respectively. e.g. GET_A -> GET_RQ_A, WRITE_SUM -> WRITE_RR_SUM -* Similar to the previous point, the _package differentiates the MAX_* sizes of the Request +* Similar to the previous point, the _package differentiates the MAX_* sizes of the Request and Response message members. e.g. MAX_A_SIZE -> MAX_RQ_A_SIZE, MAX_SUM_SIZE -> MAX_RR_SUM_SIZE -* The _package calculates both a maximum request and response message size, named +* The _package calculates both a maximum request and response message size, named MAX__RQ_SIZE and MAX__RR_SIZE, respectively. - The maximum includes the service overhead bytes that are contained in the DDS Payloads. The constant - SERVICE_OVERHEAD_BYTES from ros_package gives this overhead bytes. + The maximum includes the service overhead bytes that are contained in the DDS Payloads. The constant + ROS_SERVICE_OVERHEAD_BYTES from ros_package gives this overhead bytes. ACTION @@ -73,35 +73,35 @@ In the IDLE stage, similar to the normal code generation, the memory signals are user facing port signals, allowing the user to write the RESULT. The 'result_addr' signal is used to index the (outer) memories. If r_sel is '1', the FETCH_RESULT stage is entered, which is responsible for fetching the correct RESULT. -The FETCH_RESULT stage is split into 2 sub-stages, a GET and a READ sub-stage. The GET sub-stage is waiting +The FETCH_RESULT stage is split into 2 sub-stages, a GET and a READ sub-stage. The GET sub-stage is waiting for all memories to be ready (ANDing the ready_in signals) before toggling the valid_in signal to initiate the memory read operation and proceeding to the next sub-stage. The READ sub-stage is waiting for all memory read operations to finish (ANDing the valid_out signals) before proceeding to the next stage. -If the RESULT contains collections, they have to be manually pushed to the +If the RESULT contains collections, they have to be manually pushed to the _ros_action_result_srv_server. In that case the next stage is a stage called PUSH_, -which, similar to the normal code generation of a collection in a writer_interface, has 2 sub-stages +which, similar to the normal code generation of a collection in a writer_interface, has 2 sub-stages (GET, WRITE). The difference is that the second sub-stage (WRITE) is not only waiting on the valid_out -signal of the memory, but also on the respective ready port signal of the +signal of the memory, but also on the respective ready port signal of the _ros_action_result_srv_server. Once the RESULT is ready and available on the _ros_action_result_srv_server, the PASSTHROUGH stage is entered. In this stage the r_sel_ack signal is toggled, signaling to the ros_action_server that -it can continue its operations. The stage is held until the r_sel goes low, in which case the IDLE stage +it can continue its operations. The stage is held until the r_sel goes low, in which case the IDLE stage is resumed. If r_index is equal to MAX_GOALS, it is treated as a special value, in which the RESULT is empty/don't care. -If that is the case the PASSTHROUGH stage is taken directly (since we don't have to fetch any particular -result from the memories), and a empty RESULT is made available to the +If that is the case the PASSTHROUGH stage is taken directly (since we don't have to fetch any particular +result from the memories), and a empty RESULT is made available to the _ros_action_result_srv_server. -If ENABLE_FEEDBACK is '0', no ROS publisher for the FEEDBACK is generated, and the FEEDBACK output ports +If ENABLE_FEEDBACK is '0', no ROS publisher for the FEEDBACK is generated, and the FEEDBACK output ports have to manually be set to default values. -NOTE: If the RESULT contains a collection, the read port signals of the +NOTE: If the RESULT contains a collection, the read port signals of the _ros_action_result_srv_server are not needed, and can be hardwired to defaults (*_ren = '0', *_valid = open, *_ack = '1', *_r = open) ACTION CLIENT ------------- -The _ros_action_client contains a FSM responsible for interfacing all the underlying service -clients and subscribers. Since this state machine is static, only the port connection of the +The _ros_action_client contains a FSM responsible for interfacing all the underlying service +clients and subscribers. Since this state machine is static, only the port connection of the instantiated entities has to be generated. -Similarly to the action server, if ENABLE_FEEDBACK is '0', the FEEDBACK output ports have to manually be +Similarly to the action server, if ENABLE_FEEDBACK is '0', the FEEDBACK output ports have to manually be set to default values. diff --git a/src/ros2/example_interfaces/AddTwoInts_package.vhd b/src/ros2/example_interfaces/AddTwoInts_package.vhd index 9a99c0e..a3911b4 100644 --- a/src/ros2/example_interfaces/AddTwoInts_package.vhd +++ b/src/ros2/example_interfaces/AddTwoInts_package.vhd @@ -3,6 +3,7 @@ use ieee.std_logic_1164.all; use ieee.numeric_std.all; use work.math_pkg.all; +use work.rtps_package.all; use work.ros_package.all; package AddTwoInts_package is @@ -10,10 +11,10 @@ package AddTwoInts_package is -- REQUEST constant MAX_RQ_A_SIZE : natural := 8; constant MAX_RQ_B_SIZE : natural := 8; -- 16 - constant MAX_ADDTWOINTS_RQ_SIZE : natural := 16 + SERVICE_OVERHEAD_BYTES; + constant MAX_ADDTWOINTS_RQ_SIZE : natural := 16 + ROS_SERVICE_OVERHEAD_BYTES + RTPS_PAYLOAD_HEADER_SIZE; -- RESPONSE constant MAX_RR_SUM_SIZE : natural := 8; - constant MAX_ADDTWOINTS_RR_SIZE : natural := 8 + SERVICE_OVERHEAD_BYTES; + constant MAX_ADDTWOINTS_RR_SIZE : natural := 8 + ROS_SERVICE_OVERHEAD_BYTES + RTPS_PAYLOAD_HEADER_SIZE; end package; \ No newline at end of file diff --git a/src/ros2/example_interfaces/Fibonacci_package.vhd b/src/ros2/example_interfaces/Fibonacci_package.vhd index 5fe3eb2..040a2dd 100644 --- a/src/ros2/example_interfaces/Fibonacci_package.vhd +++ b/src/ros2/example_interfaces/Fibonacci_package.vhd @@ -3,6 +3,7 @@ use ieee.std_logic_1164.all; use ieee.numeric_std.all; use work.math_pkg.all; +use work.rtps_package.all; use work.ros_package.all; use work.GoalInfo_package; @@ -20,7 +21,7 @@ package Fibonacci_package is constant G_RR_MAX_STAMP_SEC_SIZE : natural := GoalInfo_package.MAX_STAMP_SEC_SIZE; constant G_RR_MAX_STAMP_NANOSEC_SIZE : natural := GoalInfo_package.MAX_STAMP_NANOSEC_SIZE; constant G_RR_MAX_STAMP_SIZE : natural := GoalInfo_package.MAX_STAMP_SIZE; - constant G_RR_MAX_FIBONACCI_SIZE : natural := G_RR_MAX_ACCEPTED + G_RR_MAX_STAMP_SIZE; + constant G_RR_MAX_FIBONACCI_SIZE : natural := G_RR_MAX_ACCEPTED + G_RR_MAX_STAMP_SIZE + ROS_SERVICE_OVERHEAD_BYTES + RTPS_PAYLOAD_HEADER_SIZE; -- RESULT constant R_RQ_GOAL_ID_MAX_DEPTH : natural := GoalInfo_package.GOAL_ID_MAX_DEPTH; @@ -34,7 +35,7 @@ package Fibonacci_package is constant R_RR_MAX_STATUS_SIZE : natural := 1; constant R_RR_MAX_SEQ_SIZE : natural := R_RR_SEQ_MAX_DEPTH * 4; - constant R_RR_MAX_FIBONACCI_SIZE : natural := R_RR_MAX_STATUS_SIZE + R_RR_MAX_SEQ_SIZE; + constant R_RR_MAX_FIBONACCI_SIZE : natural := R_RR_MAX_STATUS_SIZE + R_RR_MAX_SEQ_SIZE + ROS_SERVICE_OVERHEAD_BYTES + RTPS_PAYLOAD_HEADER_SIZE; -- FEEDBACK constant F_GOAL_ID_MAX_DEPTH : natural := GoalInfo_package.GOAL_ID_MAX_DEPTH; @@ -44,6 +45,6 @@ package Fibonacci_package is constant F_MAX_GOAL_ID_SIZE : natural := GoalInfo_package.MAX_GOAL_ID_SIZE; constant F_MAX_SEQ_SIZE : natural := F_SEQ_MAX_DEPTH * 4; - constant F_MAX_FIBONACCI_SIZE : natural := F_MAX_GOAL_ID_SIZE + F_MAX_SEQ_SIZE; + constant F_MAX_FIBONACCI_SIZE : natural := F_MAX_GOAL_ID_SIZE + F_MAX_SEQ_SIZE + RTPS_PAYLOAD_HEADER_SIZE; end package; \ No newline at end of file diff --git a/src/ros2/rcl_interfaces/action_msgs/CancelGoal_package.vhd b/src/ros2/rcl_interfaces/action_msgs/CancelGoal_package.vhd index 3bfd207..8a0afbe 100644 --- a/src/ros2/rcl_interfaces/action_msgs/CancelGoal_package.vhd +++ b/src/ros2/rcl_interfaces/action_msgs/CancelGoal_package.vhd @@ -17,7 +17,7 @@ package CancelGoal_package is constant RQ_MAX_GOAL_INFO_STAMP_NANOSEC_SIZE : natural := GoalInfo_package.MAX_STAMP_NANOSEC_SIZE; constant RQ_MAX_GOAL_INFO_STAMP_SIZE : natural := GoalInfo_package.MAX_STAMP_SIZE; constant RQ_MAX_GOAL_INFO_SIZE : natural := RQ_MAX_GOAL_INFO_GOAL_ID_SIZE + RQ_MAX_GOAL_INFO_STAMP_SIZE; - constant RQ_MAX_CANCELGOAL_SIZE : natural := RQ_MAX_GOAL_INFO_SIZE; + constant RQ_MAX_CANCELGOAL_SIZE : natural := RQ_MAX_GOAL_INFO_SIZE + ROS_SERVICE_OVERHEAD_BYTES + RTPS_PAYLOAD_HEADER_SIZE; -- RESPONSE constant RR_ERROR_NONE : std_logic_vector(CDR_INT8_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(0,CDR_INT8_WIDTH)); @@ -36,5 +36,5 @@ package CancelGoal_package is constant RR_MAX_GOALS_CANCELING_STAMP_NANOSEC_SIZE : natural := GoalInfo_package.MAX_STAMP_NANOSEC_SIZE; constant RR_MAX_GOALS_CANCELING_STAMP_SIZE : natural := GoalInfo_package.MAX_STAMP_SIZE; constant RR_MAX_GOALS_CANCELING_SIZE : natural := RR_GOALS_CANCELING_MAX_DEPTH * GoalInfo_package.MAX_GOALINFO_SIZE; - constant RR_MAX_CANCELGOAL_SIZE : natural := RR_MAX_RETURN_CODE_SIZE + RR_MAX_GOALS_CANCELING_SIZE; + constant RR_MAX_CANCELGOAL_SIZE : natural := RR_MAX_RETURN_CODE_SIZE + RR_MAX_GOALS_CANCELING_SIZE + ROS_SERVICE_OVERHEAD_BYTES + RTPS_PAYLOAD_HEADER_SIZE; end package; \ No newline at end of file diff --git a/src/ros2/rcl_interfaces/action_msgs/GoalInfo_package.vhd b/src/ros2/rcl_interfaces/action_msgs/GoalInfo_package.vhd index 8cab8a6..ff6ae91 100644 --- a/src/ros2/rcl_interfaces/action_msgs/GoalInfo_package.vhd +++ b/src/ros2/rcl_interfaces/action_msgs/GoalInfo_package.vhd @@ -21,5 +21,5 @@ package GoalInfo_package is constant MAX_STAMP_NANOSEC_SIZE : natural := 4; constant MAX_STAMP_SIZE : natural := MAX_STAMP_SEC_SIZE + MAX_STAMP_NANOSEC_SIZE; - constant MAX_GOALINFO_SIZE : natural := MAX_GOAL_ID_SIZE + MAX_STAMP_SIZE; + constant MAX_GOALINFO_SIZE : natural := MAX_GOAL_ID_SIZE + MAX_STAMP_SIZE + RTPS_PAYLOAD_HEADER_SIZE; end package; \ No newline at end of file diff --git a/src/ros2/rcl_interfaces/action_msgs/GoalStatusArray_package.vhd b/src/ros2/rcl_interfaces/action_msgs/GoalStatusArray_package.vhd index f1d582a..63f1f60 100644 --- a/src/ros2/rcl_interfaces/action_msgs/GoalStatusArray_package.vhd +++ b/src/ros2/rcl_interfaces/action_msgs/GoalStatusArray_package.vhd @@ -3,6 +3,7 @@ use ieee.std_logic_1164.all; use ieee.numeric_std.all; use work.math_pkg.all; +use work.rtps_package.all; use work.ros_package.all; use work.GoalInfo_package; use work.GoalStatus_package; @@ -22,6 +23,6 @@ package GoalStatusArray_package is constant MAX_STATUS_LIST_STATUS_SIZE : natural := GoalStatus_package.MAX_STATUS_SIZE; constant MAX_STATUS_LIST_SIZE : natural := STATUS_LIST_MAX_DEPTH * (GoalStatus_package.MAX_GOALSTATUS_SIZE); - constant MAX_GOALSTATUSARRAY_SIZE : natural := MAX_STATUS_LIST_SIZE; + constant MAX_GOALSTATUSARRAY_SIZE : natural := MAX_STATUS_LIST_SIZE + RTPS_PAYLOAD_HEADER_SIZE; end package; \ No newline at end of file diff --git a/src/ros2/rcl_interfaces/action_msgs/GoalStatus_package.vhd b/src/ros2/rcl_interfaces/action_msgs/GoalStatus_package.vhd index 53d40da..7e0aa84 100644 --- a/src/ros2/rcl_interfaces/action_msgs/GoalStatus_package.vhd +++ b/src/ros2/rcl_interfaces/action_msgs/GoalStatus_package.vhd @@ -17,7 +17,7 @@ package GoalStatus_package is constant STATUS_CANCELED : std_logic_vector(CDR_INT8_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(5, CDR_INT8_WIDTH)); constant STATUS_ABORTED : std_logic_vector(CDR_INT8_WIDTH-1 downto 0) := std_logic_vector(to_unsigned(6, CDR_INT8_WIDTH)); - type GOALSTATUS_TYPE is record + type GOALSTATUS_TYPE is record goal_info : Goalinfo_package.GOALINFO_TYPE; status : std_logic_vector(CDR_INT8_WIDTH-1 downto 0); end record; @@ -25,6 +25,6 @@ package GoalStatus_package is constant MAX_GOAL_INFO_SIZE : natural := Goalinfo_package.MAX_GOALINFO_SIZE; constant MAX_STATUS_SIZE : natural := 1; - constant MAX_GOALSTATUS_SIZE : natural := MAX_GOAL_INFO_SIZE + MAX_STATUS_SIZE; + constant MAX_GOALSTATUS_SIZE : natural := MAX_GOAL_INFO_SIZE + MAX_STATUS_SIZE + RTPS_PAYLOAD_HEADER_SIZE; end package; \ No newline at end of file diff --git a/src/ros2/ros_package.vhd b/src/ros2/ros_package.vhd index be5eb53..6b2f2ec 100644 --- a/src/ros2/ros_package.vhd +++ b/src/ros2/ros_package.vhd @@ -306,7 +306,7 @@ package ros_package is type ENDPOINT_ROS_NODE_MAPPING_ARRAY_TYPE is array (natural range <>) of natural; - constant SERVICE_OVERHEAD_BYTES : natural := 16; + constant ROS_SERVICE_OVERHEAD_BYTES : natural := 16; constant GOAL_HANDLE_WIDTH : natural := WORD_WIDTH; constant GOAL_HANDLE_UNKNOWN : std_logic_vector(GOAL_HANDLE_WIDTH-1 downto 0) := (others => '1'); diff --git a/src/rtps_package.vhd b/src/rtps_package.vhd index 20fb1cb..26c7836 100644 --- a/src/rtps_package.vhd +++ b/src/rtps_package.vhd @@ -134,7 +134,7 @@ package rtps_package is constant TIME_INFINITE : TIME_TYPE := (x"ffffffff", x"fffffffe"); constant FIRST_SEQUENCENUMBER : SEQUENCENUMBER_TYPE := (x"00000000", x"00000001"); constant SEQUENCENUMBER_UNKNOWN : SEQUENCENUMBER_TYPE := (x"ffffffff", x"00000000"); - constant PROTOCOL_RTPS : std_logic_vector(PROTOCOL_WIDTH-1 downto 0) := x"52545053"; -- 'RTPS' in Ascii code + constant PROTOCOL_RTPS : std_logic_vector(PROTOCOL_WIDTH-1 downto 0) := x"52545053"; -- 'RTPS' in Ascii code constant PROTOCOLVERSION_1_0 : std_logic_vector(PROTOCOLVERSION_WIDTH-1 downto 0) := x"0100"; constant PROTOCOLVERSION_1_1 : std_logic_vector(PROTOCOLVERSION_WIDTH-1 downto 0) := x"0101"; constant PROTOCOLVERSION_2_0 : std_logic_vector(PROTOCOLVERSION_WIDTH-1 downto 0) := x"0200"; @@ -341,6 +341,9 @@ package rtps_package is constant PL_CDR2_LE : std_logic_vector(PAYLOAD_REPRESENTATION_ID_WIDTH-1 downto 0) := x"0013"; constant D_CDR_BE : std_logic_vector(PAYLOAD_REPRESENTATION_ID_WIDTH-1 downto 0) := x"0014"; constant D_CDR_LE : std_logic_vector(PAYLOAD_REPRESENTATION_ID_WIDTH-1 downto 0) := x"0015"; + + -- Size of RTPS Payload Header in Bytes + constant RTPS_PAYLOAD_HEADER_SIZE : natural := 4; -- *ENTITY ID* constant ENTITYID_UNKNOWN : std_logic_vector(ENTITYID_WIDTH-1 downto 0) := (others => '0');