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

Fix ROS1 nodes argparse issue with .launch files #465

Merged
merged 1 commit into from
Sep 22, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def select_distributed(m, n): return [i * n // m + n // (2 * m) for i in range(m
help="Device to use (cpu, cuda)", choices=["cuda", "cpu"])
parser.add_argument("--buffer_size", type=float, default=3.6,
help="Size of the audio buffer in seconds")
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def main():
type=str, default="VGG_720p", choices=["VGG_720p", "VGG_1080p"])
parser.add_argument("--device", help="Device to use, either \"cpu\" or \"cuda\", defaults to \"cuda\"",
type=str, default="cuda", choices=["cuda", "cpu"])
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def main():
parser.add_argument("--model", help="Model to use, either \"costgcn\"",
type=str, default="costgcn", choices=["costgcn"])

args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def main():
help="ROS topic to publish distances")
parser.add_argument("--dataset_fps", type=float, default=3,
help="Dataset frame rate")
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

node = ContinualSlamDatasetNode(args.dataset_path,
args.config_file_path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def main():
action='store_false',
default=True,
help='Whether to save memory or not. Add it to the command if you want to write to disk')
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

node = ContinualSlamLearner(args.config_path,
args.input_image_topic,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def main():
type=str,
default='/cl_slam/update',
help='Update topic, listened from Continual SLAM Dataset Node')
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

node = ContinualSlamPredictor(args.config_path,
args.input_image_topic,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def main():
help="Retinaface backbone, options are either 'mnet' or 'resnet', where 'mnet' detects "
"masked faces as well",
type=str, default="resnet", choices=["resnet", "mnet"])
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and mx.context.num_gpus() > 0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def main():
help="Path of the directory where the images of the faces to be recognized are stored, "
"defaults to \"./database\"",
type=str, default="./database")
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def _pre_process_input_image(image):
type=str, default=None)
parser.add_argument('-d', '--device', help='Device to use, either cpu or cuda',
type=str, default="cuda", choices=["cuda", "cpu"])
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def main():
parser.add_argument("--accelerate", help="Enables acceleration flags for pose estimation which runs when an "
"input_rgb_image_topic is provided (e.g., stride)",
default=False, action="store_true")
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def main():
parser.add_argument("--device", help="Device to use (cpu, cuda)", type=str, default="cpu", choices=["cuda", "cpu"])
parser.add_argument("--threshold", help="Confidence threshold for prediction", type=float, default=0.5)
parser.add_argument("--model", help="Model that config file will be used", type=str, default="plus_m_1.5x_416")
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def callback(self, msg_data):
parser.add_argument("--model", type=str, default="anbof", help="model to be used for prediction: anbof or gru",
choices=["anbof", "gru"])

args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def main():
type=str, default="cuda", choices=["cuda", "cpu"])
parser.add_argument("--accelerate", help="Enables acceleration flags (e.g., stride)", default=False,
action="store_true")
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def main():
type=str, default="/opendr/dataset_image")
parser.add_argument("-f", "--fps", help="Data FPS",
type=float, default=30)
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

dataset_path = args.dataset_path
mot20_subsets_path = args.mot20_subsets_path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def _landmark2numpy(landmarks):
type=str, default="pstbln_afew", choices=['pstbln_ck+', 'pstbln_casia', 'pstbln_afew'])
parser.add_argument("-s", "--shape_predictor", help="Shape predictor (landmark_extractor) to use",
type=str, default='./predictor_path')
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def main():
parser.add_argument("--device", help="Device to use (cpu, cuda)", type=str, default="cuda", choices=["cuda", "cpu"])
parser.add_argument("--backbone", help="Backbone network, defaults to \"resnet50_v1b\"",
type=str, default="resnet50_v1b", choices=["resnet50_v1b"])
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and mx.context.num_gpus() > 0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def main():
type=str, default=None)
parser.add_argument("--device", help="Device to use, either \"cpu\" or \"cuda\", defaults to \"cuda\"",
type=str, default="cuda", choices=["cuda", "cpu"])
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def callback(self, msg_rgb, msg_ir):
type=str, default=None)
parser.add_argument("--device", help='Device to use, either "cpu" or "cuda", defaults to "cuda"',
type=str, default="cuda", choices=["cuda", "cpu"])
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def main():
type=str, default=None)
parser.add_argument("--device", help="Device to use (cpu, cuda)", type=str, default="cuda", choices=["cuda", "cpu"])
parser.add_argument("--model", help="Model that config file will be used", type=str, default="plus_m_1.5x_416")
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def main():
"\"seq2seq-nms\", \"soft-nms\", \"fast-nms\", \"cluster-nms\"",
type=str, default="default",
choices=["default", "seq2seq-nms", "soft-nms", "fast-nms", "cluster-nms"])
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and mx.context.num_gpus() > 0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def main():
type=str, default="cuda", choices=["cuda", "cpu"])
parser.add_argument("--backbone", help="Backbone network, defaults to \"darknet53\"",
type=str, default="darknet53", choices=["darknet53"])
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and mx.context.num_gpus() > 0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def main():
parser.add_argument("--model_name", help="Network architecture, defaults to \"yolov5s\"",
type=str, default="yolov5s", choices=['yolov5s', 'yolov5n', 'yolov5m', 'yolov5l', 'yolov5x',
'yolov5n6', 'yolov5s6', 'yolov5m6', 'yolov5l6', 'custom'])
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def main():
)
parser.add_argument("-t", "--temp_dir", help="Path to a temporary directory with models",
type=str, default="temp")
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def main():
type=str, default="deep_sort", choices=["deep_sort"])
parser.add_argument("-td", "--temp_dir", help="Path to a temporary directory with models",
type=str, default="temp")
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def main():
type=str, default="fairmot_dla34", choices=["fairmot_dla34"])
parser.add_argument("-td", "--temp_dir", help="Path to a temporary directory with models",
type=str, default="temp")
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def main():
type=str, default=None)
parser.add_argument("--device", help="Device to use, either \"cpu\" or \"cuda\", defaults to \"cuda\"",
type=str, default="cuda", choices=["cuda", "cpu"])
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and mx.context.num_gpus() > 0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def main():
)
parser.add_argument("-td", "--temp_dir", help="Path to a temporary directory with models",
type=str, default="temp")
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

input_point_cloud_topic = args.input_point_cloud_topic
detector_model_name = args.detector_model_name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def callback(self, data: ROS_PointCloud2):
parser.add_argument("--performance_topic", help="Topic name for performance messages, disabled (None) by default",
type=str, default=None)

args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

efficient_lps_node = EfficientLpsNode(args.input_point_cloud_2_topic,
args.checkpoint,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def callback(self, data: ROS_Image):
panoptic segmentation maps and publish it on OUTPUT_RGB_IMAGE_TOPIC')
parser.add_argument('--checkpoint', type=str, default='cityscapes',
help='download pretrained models [cityscapes, kitti] or load from the provided path')
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

efficient_ps_node = EfficientPsNode(args.input_rgb_image_topic,
args.checkpoint,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def main():
type=str, default="/opendr/performance")
parser.add_argument("-w", "--window", help="The window to use in frames to calculate running average FPS",
type=int, default=20)
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

performance_node = PerformanceNode(input_performance_topic=args.input_performance_topic,
window_length=args.window)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def _init_dataset(self):
help='topic for the output point cloud')
parser.add_argument('-t', '--test_data', action='store_true',
help='Use uploaded test data on the FTP server')
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

if args.test_data:
args.dataset_path = EfficientLpsLearner.download(args.dataset_path, mode="test_data", prepare_data=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def main():
type=str, default="/opendr/dataset_point_cloud")
parser.add_argument("-f", "--fps", help="Data FPS",
type=float, default=10)
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

dataset_path = args.dataset_path
kitti_subsets_path = args.kitti_subsets_path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def main():
type=str, default="cuda", choices=["cuda", "cpu"])
parser.add_argument("--accelerate", help="Enables acceleration flags (e.g., stride)", default=False,
action="store_true")
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def preprocess(self, rgb_image, depth_image):
parser.add_argument("--delay", help="The delay (in seconds) with which RGB message and"
"depth message can be synchronized", type=float, default=0.1)

args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def main():
type=str, default=None)
parser.add_argument("--device", help="Device to use, either \"cpu\" or \"cuda\", defaults to \"cuda\"",
type=str, default="cuda", choices=["cuda", "cpu"])
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def _pose2numpy(num_current_frames, poses_list):
parser.add_argument("--model", help="Model to use, either \"stgcn\" or \"pstgcn\"",
type=str, default="stgcn", choices=["stgcn", "pstgcn"])

args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def callback(self, msg_data):
help="Model to be used for prediction: matchboxnet, edgespeechnets or quad_selfonn")
parser.add_argument("--model_path", type=str,
help="Path to the model files, if not given, the pretrained model will be downloaded")
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ def main():
"--sample_rate", type=int, default=16000, help="Sampling rate for audio data."
"Check your audio source for correct value."
)
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def main():
parser.add_argument("--model", help="Architecture to use for human activity recognition.",
type=str, default="cox3d-m",
choices=["cox3d-s", "cox3d-m", "cox3d-l", "x3d-xs", "x3d-s", "x3d-m", "x3d-l"])
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def main():
type=str, default="cuda", choices=["cuda", "cpu"])
parser.add_argument("--accelerate", help="Enables acceleration flags (e.g., stride)", default=False,
action="store_true")
args = parser.parse_args()
args = parser.parse_args(rospy.myargv()[1:])

try:
if args.device == "cuda" and torch.cuda.is_available():
Expand Down
Loading