Skip to content

Commit

Permalink
fix(schema): handle zeros and floats for default config generation (#170
Browse files Browse the repository at this point in the history
)

* fix(schema): handle zeros and floats for default config generation

Signed-off-by: Amadeusz Szymko <[email protected]>

* ci(pre-commit): autofix

---------

Signed-off-by: Amadeusz Szymko <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
amadeuszsz and pre-commit-ci[bot] authored Jul 4, 2024
1 parent 3812ba3 commit 84db0ff
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 41 deletions.
2 changes: 1 addition & 1 deletion build_depends.repos
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ repositories:
ros2_socketcan:
type: git
url: https://github.com/knzo25/ros2_socketcan
version: feat/continental_fd
version: feat/continental_fd
2 changes: 1 addition & 1 deletion nebula_ros/launch/continental_launch_all_hw.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<remap from="steering_angle_input" to="$(var steering_angle_topic)"/>
</node>
</group>

<group if="$(eval &quot;'$(var sensor_model)' == 'SRR520' &quot;)" >

<node pkg="nebula_ros" exec="continental_srr520_ros_wrapper_node" name="nebula_continental_srr520" output="screen">
Expand Down
8 changes: 4 additions & 4 deletions nebula_ros/schema/PandarAT128.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@
},
"cloud_min_angle": {
"$ref": "sub/misc.json#/definitions/cloud_min_angle",
"default": 30,
"default": "30",
"minimum": 30,
"maximum": 150
},
"cloud_max_angle": {
"$ref": "sub/misc.json#/definitions/cloud_max_angle",
"default": 150,
"default": "150",
"minimum": 30,
"maximum": 150
},
"scan_phase": {
"$ref": "sub/misc.json#/definitions/scan_phase",
"default": 30.0,
"default": "30.0",
"minimum": 30.0,
"maximum": 150.0
},
Expand All @@ -68,7 +68,7 @@
},
"rotation_speed": {
"$ref": "sub/hardware.json#/definitions/rotation_speed",
"default": 200,
"default": "200",
"enum": [
200,
400
Expand Down
8 changes: 6 additions & 2 deletions nebula_ros/schema/SRR520.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,14 @@
"$ref": "#/definitions/SRR520"
}
},
"required": ["ros__parameters"],
"required": [
"ros__parameters"
],
"additionalProperties": false
}
},
"required": ["/**"],
"required": [
"/**"
],
"additionalProperties": false
}
2 changes: 1 addition & 1 deletion nebula_ros/schema/example.schema.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"properties": {
"example_parameter_1": {
"type": "integer",
"default": 42,
"default": "42",
"readOnly": true,
"description": "Exclusive parameter only for this sensor model."
},
Expand Down
32 changes: 21 additions & 11 deletions nebula_ros/schema/sub/communication.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
"definitions": {
"configuration_host_port": {
"type": "integer",
"default": 42401,
"default": "42401",
"minimum": 0,
"readOnly": true,
"description": "Host configuration port."
},
"configuration_sensor_port": {
"type": "integer",
"default": 42101,
"default": "42101",
"minimum": 0,
"readOnly": true,
"description": "Sensor configuration port."
},
"data_port": {
"type": "integer",
"default": 2368,
"default": "2368",
"minimum": 0,
"readOnly": true,
"description": "Sensor data port."
Expand All @@ -31,7 +31,7 @@
},
"gnss_port": {
"type": "integer",
"default": 2369,
"default": "2369",
"minimum": 0,
"readOnly": true,
"description": "GNSS port."
Expand All @@ -57,7 +57,7 @@
},
"packet_mtu_size": {
"type": "integer",
"default": 1500,
"default": "1500",
"minimum": 0,
"readOnly": true,
"description": "Packet MTU size."
Expand All @@ -72,37 +72,47 @@
"ptp_profile": {
"type": "string",
"default": "1588v2",
"enum": ["1588v2", "802.1as", "automotive"],
"enum": [
"1588v2",
"802.1as",
"automotive"
],
"description": "PTP profile."
},
"ptp_domain": {
"type": "integer",
"default": 0,
"default": "0",
"minimum": 0,
"maximum": 127,
"description": "PTP domain (PTP operates within a logical scope)."
},
"ptp_transport_type": {
"type": "string",
"default": "UDP",
"enum": ["UDP", "L2"],
"enum": [
"UDP",
"L2"
],
"description": "1588v2 supports 'UDP' or 'L2', other profiles only L2 (HW)."
},
"ptp_switch_type": {
"type": "string",
"default": "TSN",
"enum": ["TSN", "NON_TSN"],
"enum": [
"TSN",
"NON_TSN"
],
"description": "For automotive profile,'TSN' or 'NON_TSN'."
},
"receiver_timeout_sec": {
"type": "number",
"default": 0.03,
"default": "0.03",
"minimum": 0.0,
"description": "Timeout for reading data from the CAN bus."
},
"sender_timeout_sec": {
"type": "number",
"default": 0.01,
"default": "0.01",
"minimum": 0.0,
"description": "Timeout for sending data to the CAN bus."
}
Expand Down
7 changes: 4 additions & 3 deletions nebula_ros/schema/sub/hardware.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"definitions": {
"launch_hw": {
"type": "boolean",
"readOnly": false,
"default": "true",
"readOnly": true,
"description": "Whether network sockets should be opened or not. If disabled, replay from NebulaPackets messages is enabled automatically."
},
"rotation_speed": {
Expand All @@ -19,13 +20,13 @@
},
"setup_sensor": {
"type": "boolean",
"default": true,
"default": "true",
"readOnly": true,
"description": "Enable sensor setup on hardware driver."
},
"retry_hw": {
"type": "boolean",
"default": true,
"default": "true",
"description": "Whether TCP connections are retried on failure or the driver should instead exit."
}
}
Expand Down
4 changes: 2 additions & 2 deletions nebula_ros/schema/sub/lidar_hesai.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
},
"gnss_port": {
"$ref": "communication.json#/definitions/gnss_port",
"default": 10110,
"default": "10110",
"minimum": 0
},
"rotation_speed": {
"$ref": "hardware.json#/definitions/rotation_speed",
"default": 600,
"default": "600",
"minimum": 300,
"maximum": 1200,
"multipleOf": 60
Expand Down
2 changes: 1 addition & 1 deletion nebula_ros/schema/sub/lidar_velodyne.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"rotation_speed": {
"$ref": "hardware.json#/definitions/rotation_speed",
"default": 600,
"default": "600",
"minimum": 300,
"maximum": 1200,
"multipleOf": 60
Expand Down
20 changes: 10 additions & 10 deletions nebula_ros/schema/sub/misc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,62 +16,62 @@
},
"cloud_max_angle": {
"type": "integer",
"default": 360,
"default": "360",
"minimum": 0,
"maximum": 360,
"description": "Field of View, end degrees."
},
"cloud_min_angle": {
"type": "integer",
"default": 0,
"default": "0",
"minimum": 0,
"maximum": 360,
"description": "Field of View, start degrees."
},
"configuration_vehicle_height": {
"type": "number",
"default": 2.5,
"default": "2.5",
"minimum": 0.0,
"readOnly": true,
"description": "New vehicle height."
},
"configuration_vehicle_length": {
"type": "number",
"default": 4.9,
"default": "4.9",
"minimum": 0.0,
"readOnly": true,
"description": "New vehicle length."
},
"configuration_vehicle_wheelbase": {
"type": "number",
"default": 2.8,
"default": "2.8",
"minimum": 0.0,
"readOnly": true,
"description": "New vehicle wheelbase."
},
"configuration_vehicle_width": {
"type": "number",
"default": 1.9,
"default": "1.9",
"minimum": 0.0,
"readOnly": true,
"description": "New vehicle width."
},
"dual_return_distance_threshold": {
"type": "number",
"default": 0.1,
"default": "0.1",
"minimum": 0.01,
"maximum": 0.5,
"description": "Distance threshold between two neighboring points for dual return mode."
},
"max_range": {
"type": "number",
"default": 300.0,
"default": "300.0",
"minimum": 0.0,
"description": "Sensor maximum single point range."
},
"min_range": {
"type": "number",
"default": 0.3,
"default": "0.3",
"minimum": 0.0,
"description": "Sensor minimum single point range."
},
Expand All @@ -81,7 +81,7 @@
},
"scan_phase": {
"type": "number",
"default": 0.0,
"default": "0.0",
"minimum": 0.0,
"maximum": 360.0,
"description": "Sensor scan phase."
Expand Down
8 changes: 4 additions & 4 deletions nebula_ros/schema/sub/topic.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"definitions": {
"advanced_diagnostics": {
"type": "boolean",
"default": false,
"default": "false",
"readOnly": true,
"description": "Enable advanced diagnostics."
},
Expand All @@ -17,7 +17,7 @@
},
"diag_span": {
"type": "integer",
"default": 1000,
"default": "1000",
"minimum": 1,
"readOnly": true,
"description": "Diagnostics rate."
Expand All @@ -36,13 +36,13 @@
},
"use_bus_time": {
"type": "boolean",
"default": false,
"default": "false",
"readOnly": true,
"description": "Use CAN bus time for published sensor data."
},
"use_sensor_time": {
"type": "boolean",
"default": false,
"default": "false",
"readOnly": true,
"description": "Use sensor time for published sensor data."
}
Expand Down
2 changes: 1 addition & 1 deletion nebula_ros/schema/sub/type_vendor.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"example_parameter_1": {
"type": "integer",
"default": 42,
"default": "42",
"readOnly": true,
"description": "Exclusive parameter only for specific sensor vendor."
},
Expand Down

0 comments on commit 84db0ff

Please sign in to comment.