latest pushes
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
import json
|
||||
import os
|
||||
import requests
|
||||
import sys
|
||||
|
||||
def main():
|
||||
# Get the absolute path to the config file
|
||||
@ -18,25 +17,13 @@ def main():
|
||||
url = config['url']
|
||||
endpoint_path = config['endpoint_path']
|
||||
|
||||
# Get the parameters from the launch file
|
||||
x1_str = os.getenv('x1')
|
||||
y1_str = os.getenv('y1')
|
||||
x2_str = os.getenv('x2')
|
||||
y2_str = os.getenv('y2')
|
||||
limit_str = os.getenv('limit')
|
||||
# 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')
|
||||
|
||||
# Check if any of the environment variables are not set
|
||||
if any(v is None for v in [x1_str, y1_str, x2_str, y2_str, limit_str]):
|
||||
print("One or more required environment variables are not set.")
|
||||
return
|
||||
|
||||
# Convert the parameters to float or int
|
||||
x1 = float(x1_str)
|
||||
y1 = float(y1_str)
|
||||
x2 = float(x2_str)
|
||||
y2 = float(y2_str)
|
||||
limit = int(limit_str)
|
||||
|
||||
# JSON payload
|
||||
payload = {
|
||||
"node0": {"x": x1, "y": y1},
|
||||
@ -64,4 +51,10 @@ def main():
|
||||
print("Error:", e)
|
||||
|
||||
if __name__ == '__main__':
|
||||
ros_version = os.getenv("ROS_VERSION")
|
||||
if ros_version == "1":
|
||||
import rospy
|
||||
elif ros_version == "2":
|
||||
rclpy
|
||||
|
||||
main()
|
||||
|
Reference in New Issue
Block a user