Skip to content

Commit

Permalink
refactor: fix use ttyusb1
Browse files Browse the repository at this point in the history
  • Loading branch information
FaaizHaikal committed Mar 4, 2024
1 parent aa6df3d commit 6c0446c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
14 changes: 4 additions & 10 deletions src/check_rpy_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

int main(int argc, char * argv[])
{
std::string port_name = "/dev/ttyUSB0";
std::string port_name = "/dev/ttyUSB1";

if (argc > 1) {
port_name = argv[1];
Expand All @@ -40,15 +40,9 @@ int main(int argc, char * argv[])
if (mpu.connect()) {
std::cout << "succeeded to connect to mpu " << port_name << "!\n";
} else {
port_name = "/dev/ttyUSB1";
mpu.set_port_name(port_name);
if (mpu.connect()) {
std::cout << "succeeded to connect to mpu " << port_name << "!\n";
} else {
std::cout << "failed to connect to mpu!\n" <<
"try again!\n";
return 0;
}
std::cout << "failed to connect to mpu!\n" <<
"try again!\n";
return 0;
}

while (true) {
Expand Down
14 changes: 4 additions & 10 deletions src/kansei_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int main(int argc, char * argv[])
{
rclcpp::init(argc, argv);

std::string port_name = "/dev/ttyUSB0";
std::string port_name = "/dev/ttyUSB1";
std::string path = "";
kansei::fallen::DeterminantType determinant_type;

Expand Down Expand Up @@ -88,15 +88,9 @@ int main(int argc, char * argv[])
if (mpu->connect()) {
std::cout << "succeeded to connect to mpu " << port_name << "!\n";
} else {
port_name = "/dev/ttyUSB1";
mpu->set_port_name(port_name);
if (mpu->connect()) {
std::cout << "succeeded to connect to mpu " << port_name << "!\n";
} else {
std::cout << "failed to connect to mpu!\n" <<
"try again!\n";
return 0;
}
std::cout << "failed to connect to mpu!\n" <<
"try again!\n";
return 0;
}

auto node = std::make_shared<rclcpp::Node>("kansei_node");
Expand Down

0 comments on commit 6c0446c

Please sign in to comment.