diff --git a/ros_web_api_bellande_adaptive_continuious_control_system/config/configs.json b/ros_web_api_bellande_adaptive_continuious_control_system/config/configs.json
index 0ceecdd..4def0b6 100644
--- a/ros_web_api_bellande_adaptive_continuious_control_system/config/configs.json
+++ b/ros_web_api_bellande_adaptive_continuious_control_system/config/configs.json
@@ -18,5 +18,7 @@
"url": "https://bellanderoboticssensorsresearchinnovationcenter-kot42qxp.b4a.run",
"endpoint_path": {
"bellande_control_system_base": "/api/Bellande_Adaptive_Continuious_Control_System/bellande_adaptive_continuious_control_system"
- }
+ },
+ "connectivity_passcode": "user_input_passcode",
+ "Bellande_Framework_Access_Key": "bellande_web_api_opensource"
}
diff --git a/ros_web_api_bellande_adaptive_continuious_control_system/launch/bellande_control_system.launch.py b/ros_web_api_bellande_adaptive_continuious_control_system/launch/bellande_control_system.launch.py
index b2614ea..428ebc3 100644
--- a/ros_web_api_bellande_adaptive_continuious_control_system/launch/bellande_control_system.launch.py
+++ b/ros_web_api_bellande_adaptive_continuious_control_system/launch/bellande_control_system.launch.py
@@ -29,12 +29,12 @@ def ros1_launch_description():
def ros2_launch_description():
initial_state_arg = DeclareLaunchArgument('initial_state', default_value='idle')
name_arg = DeclareLaunchArgument('name', default_value='BellandeControlSystem')
- action_parameters_arg = DeclareLaunchArgument('action_parameters', default_value='{}')
+ connectivity_passcode_arg = DeclareLaunchArgument('connectivity_passcode', default_value='default_passcode')
+ bellande_framework_access_key_arg = DeclareLaunchArgument('bellande_framework_access_key', default_value='bellande_web_api_opensource')
nodes_to_launch = []
-
ros_launch_arguments = [
- initial_state_arg, name_arg, action_parameters_arg,
+ initial_state_arg, name_arg, connectivity_passcode_arg, bellande_framework_access_key_arg,
]
nodes_to_launch.append(Node(
@@ -45,7 +45,8 @@ def ros2_launch_description():
parameters=[
{'initial_state': LaunchConfiguration('initial_state')},
{'name': LaunchConfiguration('name')},
- {'action_parameters': LaunchConfiguration('action_parameters')},
+ {'connectivity_passcode': LaunchConfiguration('connectivity_passcode')},
+ {'bellande_framework_access_key': LaunchConfiguration('bellande_framework_access_key')},
],
))
diff --git a/ros_web_api_bellande_adaptive_continuious_control_system/launch/ros1/bellande_control_system.launch b/ros_web_api_bellande_adaptive_continuious_control_system/launch/ros1/bellande_control_system.launch
index 699eaf0..8b21291 100644
--- a/ros_web_api_bellande_adaptive_continuious_control_system/launch/ros1/bellande_control_system.launch
+++ b/ros_web_api_bellande_adaptive_continuious_control_system/launch/ros1/bellande_control_system.launch
@@ -1,6 +1,5 @@
-
+
+
-
+
+
diff --git a/ros_web_api_bellande_adaptive_continuious_control_system/src/bellande_control_system.py b/ros_web_api_bellande_adaptive_continuious_control_system/src/bellande_control_system.py
index f812d44..9a1c3bf 100755
--- a/ros_web_api_bellande_adaptive_continuious_control_system/src/bellande_control_system.py
+++ b/ros_web_api_bellande_adaptive_continuious_control_system/src/bellande_control_system.py
@@ -18,14 +18,16 @@ import os
import requests
from std_msgs.msg import String
-def bellande_control_system(state, action, parameters):
+def bellande_control_system(state, action, parameters, connectivity_passcode):
payload = {
"state": state,
"action": action,
- "parameters": parameters
+ "parameters": parameters,
+ "connectivity_passcode": connectivity_passcode
}
headers = {
- "Authorization": f"Bearer {api_access_key}"
+ "Authorization": f"Bearer {Bellande_Framework_Access_Key}",
+ "X-Connectivity-Passcode": connectivity_passcode
}
response = requests.post(api_url, json=payload, headers=headers)
if response.status_code == 200:
@@ -36,20 +38,26 @@ def bellande_control_system(state, action, parameters):
return None, None
def control_callback(msg):
- current_state = rospy.get_param('current_state', 'idle')
- action = msg.data
- parameters = json.loads(rospy.get_param('action_parameters', '{}'))
+ data = json.loads(msg.data)
+ connectivity_passcode = data['connectivity_passcode']
+ current_state = rospy.get_param(f'current_state_{connectivity_passcode}', 'idle')
+ action = data['action']
+ parameters = data['parameters']
- output, next_state = bellande_control_system(current_state, action, parameters)
+ output, next_state = bellande_control_system(current_state, action, parameters, connectivity_passcode)
if output is not None:
output_msg = String()
- output_msg.data = json.dumps({"output": output, "next_state": next_state})
+ output_msg.data = json.dumps({
+ "output": output,
+ "next_state": next_state,
+ "connectivity_passcode": connectivity_passcode
+ })
pub.publish(output_msg)
if next_state:
- rospy.set_param('current_state', next_state)
+ rospy.set_param(f'current_state_{connectivity_passcode}', next_state)
def main():
- global api_url, api_access_key, pub
+ global api_url, Bellande_Framework_Access_Key, pub
config_file_path = os.path.join(os.path.dirname(__file__), '../config/configs.json')
if not os.path.exists(config_file_path):
@@ -60,7 +68,7 @@ def main():
config = json.load(config_file)
url = config['url']
endpoint_path = config['endpoint_path']["bellande_control_system_base"]
- api_access_key = config["Bellande_Framework_Access_Key"]
+ Bellande_Framework_Access_Key = config["Bellande_Framework_Access_Key"]
# Initialize ROS node
if ros_version == "1":