Skip to content

Commit

Permalink
Merge pull request #38 from ichiro-its/feature/adapt-main-to-ros2-launch
Browse files Browse the repository at this point in the history
[Feature / PD-420] Adapt Kansei Main to Remove Ros Arguments
  • Loading branch information
hiikariri authored Jun 25, 2024
2 parents 0b00ce6 + 671b3dd commit 98fc145
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/kansei_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

int main(int argc, char * argv[])
{
rclcpp::init(argc, argv);
auto args = rclcpp::init_and_remove_ros_arguments(argc, argv);

std::string port_name = "/dev/ttyUSB1";
std::string path = "";
Expand All @@ -46,23 +46,23 @@ int main(int argc, char * argv[])
"Optional:\n"
"-h, --help show this help message and exit\n";

if (argc > 1) {
for (int i = 1; i < argc; i++) {
std::string arg = argv[i];
if (args.size() > 1) {
for (int i = 1; i < args.size(); i++) {
const std::string& arg = args[i];
if (arg == "-h" || arg == "--help") {
std::cout << help_message << std::endl;
return 1;
} else if (arg == "--path") {
if (i + 1 < argc) {
path = argv[i + 1];
if (i + 1 < args.size()) {
path = args[i + 1];
i++;
} else {
std::cerr << "Error: --path requires a path argument" << std::endl;
return 1;
}
} else if (arg == "--type") {
if (i + 1 < argc) {
std::string fallen_type = argv[i + 1];
if (i + 1 < args.size()) {
const std::string& fallen_type = args[i + 1];
if (fallen_type == "orientation") {
determinant_type = kansei::fallen::DeterminantType::ORIENTATION;
} else if (fallen_type == "accelero") {
Expand Down

0 comments on commit 98fc145

Please sign in to comment.