-
Notifications
You must be signed in to change notification settings - Fork 177
Expand file tree
/
Copy pathcomponent
More file actions
executable file
·104 lines (94 loc) · 4.24 KB
/
component
File metadata and controls
executable file
·104 lines (94 loc) · 4.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#! /usr/bin/env python3
import sys
from textwrap import wrap
import os
MAX_CHARACTERS = 80
COMPONENTS = [
{
"name": "esp_idf",
"description": "micro-ROS component for ESP-IDF: this package enables the integration of micro-ROS in any Espressif ESP32 IDF project.",
"url" : "https://github.com/micro-ROS/micro_ros_espidf_component"
},
{
"name": "zephyr_rtos",
"description": "micro-ROS module for Zephyr RTOS: this package enables the integration of micro-ROS in any Zephyr RTOS workspace.",
"url" : "https://github.com/micro-ROS/micro_ros_zephyr_module"
},
{
"name": "mbed_rtos",
"description": "micro-ROS module for Mbed RTOS: this package enables the integration of micro-ROS in any Mbed RTOS workspace.",
"url" : "https://github.com/micro-ROS/micro_ros_mbed"
},
{
"name": "nuttx_rtos",
"description": "micro-ROS module for NuttX RTOS: this package enables the integration of micro-ROS in any NuttX RTOS workspace.",
"url" : "https://github.com/micro-ROS/micro_ros_nuttx_app"
},
{
"name": "azure_rtos",
"description": "micro-ROS module for Microsoft Azure RTOS: this package enables the integration of micro-ROS in a Microsoft Azure RTOS workspace.",
"url" : "https://github.com/micro-ROS/micro_ros_azure_rtos_app"
},
{
"name": "tiva_c_series",
"description": "micro-ROS app for TI Tiva™ C Series: this package enables the integration of micro-ROS in Texas Instruments Tiva™ C Series.",
"url" : "https://github.com/micro-ROS/micro_ros_tivac_launchpad_app"
},
{
"name": "stm32cube",
"description": "micro-ROS utils for STM32CubeMX and STM32CubeIDE: this package enables the integration of micro-ROS in STM32CubeMX and STM32CubeIDE.",
"url" : "https://github.com/micro-ROS/micro_ros_stm32cubemx_utils"
},
{
"name": "platformio",
"description": "micro-ROS module for PlatformIO: this package enables the integration of micro-ROS in PlatformIO.",
"url" : "https://github.com/micro-ROS/micro_ros_platformio"
},
{
"name": "arduino",
"description": "Arduino IDE & CLI libraries for micro-ROS: this package enables the integration of micro-ROS in the Arduino IDE for some hardware platforms.",
"url" : "https://github.com/micro-ROS/micro_ros_arduino"
},
{
"name": "raspberry_pi_pico",
"description": "Raspberry Pi Pico SDK libraries for micro-ROS: this package enables the integration of micro-ROS in the Raspberry Pi Pico SDK.",
"url" : "https://github.com/micro-ROS/micro_ros_raspberrypi_pico_sdk"
}
]
def print_help(extended = False):
if extended:
print("Usage: ros2 run micro_ros_setup component <component_name>")
print("")
for component in COMPONENTS:
description = "\n\t".join(wrap(component["description"], MAX_CHARACTERS))
print("[{}] \n\t{}\n".format(component["name"], description))
else:
print("Usage: ros2 run micro_ros_setup component <component_name>")
print("Available components: {}".format(", ".join([c["name"] for c in COMPONENTS])))
# No arguments
if len(sys.argv) < 2:
print_help()
sys.exit(0)
# User asks for help
if "-h" in sys.argv or "--help" in sys.argv:
print_help(True)
sys.exit(0)
# Component select
component_name = sys.argv[1]
if component_name in [x["name"] for x in COMPONENTS]:
component = [x for x in COMPONENTS if x["name"] == component_name][0]
repo_folder_name = os.getcwd() + "/" + component["url"].split("/")[-1]
print("Using micro-ROS {} component".format(component_name))
print("\t{}".format("\n\t".join(wrap(component["description"], MAX_CHARACTERS))))
print("")
if os.path.exists(repo_folder_name):
print("Folder {} already exists!".format(repo_folder_name))
else:
print("Cloning repository...")
os.system("git clone {} > /dev/null 2>&1".format(component["url"]))
print("{} repository cloned at {}".format(component_name, repo_folder_name))
print("")
print("FOR USAGE INSTRUCTIONS VISIT: {}".format(component["url"] + "#readme"))
else:
print("Unknown component: {}".format(component_name))
print_help(True)