diff --git a/ros_web_api_bellande_step/launch/bellande_step_api_2d.launch.py b/ros_web_api_bellande_step/launch/bellande_step_api_2d.launch.py index c235410..d6e8a89 100644 --- a/ros_web_api_bellande_step/launch/bellande_step_api_2d.launch.py +++ b/ros_web_api_bellande_step/launch/bellande_step_api_2d.launch.py @@ -8,7 +8,7 @@ def ros1_launch_description(): args = sys.argv[1:] # Construct the ROS 1 launch command - roslaunch_command = ["roslaunch", "ros_web_api_bellande_step", "bellande_step_api_2d.py"] + args + roslaunch_command = ["roslaunch", "ros_web_api_bellande_step", "bellande_step_api_2d.launch"] + args # Execute the launch command subprocess.call(roslaunch_command) diff --git a/ros_web_api_bellande_step/src/bellande_step_api_2d.py b/ros_web_api_bellande_step/src/bellande_step_api_2d.py index 2adefa4..118edce 100755 --- a/ros_web_api_bellande_step/src/bellande_step_api_2d.py +++ b/ros_web_api_bellande_step/src/bellande_step_api_2d.py @@ -18,11 +18,11 @@ def main(): endpoint_path = config['endpoint_path']["2d"] # Get the parameters from the ROS parameter server - x1 = rospy.get_param('x1') - y1 = rospy.get_param('y1') - x2 = rospy.get_param('x2') - y2 = rospy.get_param('y2') - limit = rospy.get_param('limit') + x1 = rospy.get_param('x1', 0) + y1 = rospy.get_param('y1', 0) + x2 = rospy.get_param('x2', 0) + y2 = rospy.get_param('y2', 0) + limit = rospy.get_param('limit', 3) # JSON payload payload = { @@ -47,6 +47,7 @@ def main(): response.raise_for_status() # Raise an error for unsuccessful responses data = response.json() print("Next Step:", data['next_step']) + except requests.exceptions.RequestException as e: print("Error:", e) @@ -55,6 +56,6 @@ if __name__ == '__main__': if ros_version == "1": import rospy elif ros_version == "2": - rclpy + import rclpy main()