Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates from @divbugger to be reviewd #26

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": false
},
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": false,
"args": [
"--package",
"usb_cam",
"--name",
"--all",
"--node",
"--model-path",
"/home/divya/ros2_ws/runner_op",
"--ws",
"/home/divya/ros2_ws",
"--repo",
"https://github.com/ros-drivers/usb_cam.git -b ros2",
"--path-to-src",
//"~/ros2_ws/src/ros_tutorials/turtlesim"
"~/ros2_ws/src/usb_cam"
]
}
]
}
44 changes: 44 additions & 0 deletions haros_runner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env python
import sys
import os
import subprocess
from datetime import datetime
import shutil
import glob

from rosHumble_model_extractor_scripts.ros2runner import ros2Runner

# Arguments:
# 1: Package name or Git repository name
# 2: Node name or launch file name or '--all' to analyse all the available nodes
# 3: Type of the request: either 'launch' or 'node'
# 4: Path to the folder where the resulting model files should be stored
# 5: Path to the ROS workspace
# 6: Http address links of the Git repositories (to indicate the branch put the name of the repository between quotes and add the suffix -b *banch_name*, for example "https://github.com/ipa320/ros-model-extractors b main"

def main():

CLI_args = sys.argv[1:]

if len(CLI_args) < 6:
print(f'ERROR: At least 6 arguments expected, only {len(CLI_args)} are given.')
sys.exit()

pkgName = sys.argv[1]
NodeName = sys.argv[2]
typeOfRequest = sys.argv[3]
pathToOutput = sys.argv[4]
pathToROSws = sys.argv[5]
gitRepo = sys.argv[6]

ros2Extractor = ros2Runner(inputPkgName=pkgName,
inputNodeName=NodeName,
typeOfRequest=typeOfRequest,
pathToROSws=pathToROSws,
gitRepo=gitRepo,
outputDir=pathToOutput)
ros2Extractor.extractorRun(True)


if __name__ == "__main__":
main()
9 changes: 5 additions & 4 deletions haros_runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ then
then
if [ "${2}" = "--all" ]
then
python3 /ros_model_extractor.py --package "$1" --"${3}" --model-path "${4}" --ws "${5}" --path-to-src "$path_to_src_code" --repo $model_repo -a >> extractor.log
python3 /ros_model_extractor.py --package "$1" --"${3}" --model-path "${4}" --ws "${5}" --path-to-src "$path_to_src_code" --repo $model_repo -a >> ${4}/extractor.log
else
python3 /ros_model_extractor.py --package "$1" --name "$2" --"${3}" --model-path "${4}" --ws "${5}" --path-to-src "$path_to_src_code" --repo $model_repo>> extractor.log
python3 /ros_model_extractor.py --package "$1" --name "$2" --"${3}" --model-path "${4}" --ws "${5}" --path-to-src "$path_to_src_code" --repo $model_repo>> ${4}/extractor.log
fi
#cat extractor.log
else
Expand All @@ -102,7 +102,7 @@ fi

echo "~~~~~~~~~~~"
echo "Extraction finished. See the following report:"
cat extractor.log
cat ${4}/extractor.log
echo "~~~~~~~~~~~"

echo "###########"
Expand All @@ -118,4 +118,5 @@ echo "###########"
done

## Clean and finish
rm -rf ${5}/src/*
# rm -rf ${5}/src/*
# rm -rf ${4}/*
Loading
Loading