This commit is contained in:
Ronaldson Bellande 2024-04-10 02:34:46 -04:00
parent 11a83e7343
commit 980f10232b
4 changed files with 31 additions and 4 deletions

View File

@ -1,9 +1,6 @@
cmake_minimum_required(VERSION 3.8)
project(ros_web_api_bellande_step)
## Compile as C++11, supported in ROS Kinetic and newer
add_compile_options(-std=c++11)
# Find ROS
if($ENV{ROS_VERSION} EQUAL 1)
find_package(catkin REQUIRED COMPONENTS

View File

@ -0,0 +1,29 @@
#!/bin/bash
# Create and navigate to build directory
mkdir -p build && cd build
# Build package
if [ $ROS_VERSION -eq 1 ]; then
cmake -DROS_VERSION=1 ..
make -j$(nproc)
else
cmake -DROS_VERSION=2 ..
make -j$(nproc)
fi
# Source package setup file
source devel/setup.bash
# Run rosdep
rosdep install --from-paths ../src --ignore-src -y
# Return to package root directory
cd ..
# Run ROS launch file
if [ $ROS_VERSION -eq 1 ]; then
roslaunch ros_web_api_bellande_step bellande_step_api_2d_launch.launch.py x1:=0 y1:=0 x2:=5 y2:=5 limit:=3
else
ros2 launch ros_web_api_bellande_step bellande_step_api_2d_launch.launch.py x1:=0 y1:=0 x2:=5 y2:=5 limit:=3
fi

View File

@ -1,10 +1,11 @@
import json
import os
import requests
import sys
def main():
# Read configuration from config.json
with open('config.json', 'r') as config_file:
with open(os.path.join(sys.path[0], 'config.json'), 'r') as config_file:
config = json.load(config_file)
url = config['url']
endpoint_path = config['endpoint_path']