Skip to content

Commit 9cf09b5

Browse files
authored
Run virtual iridium when starting local transceiver in DEV mode (#478)
1 parent 5379237 commit 9cf09b5

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/network_systems/projects/local_transceiver/src/local_transceiver_ros_intf.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,22 @@ class LocalTransceiverIntf : public NetNode
4242
if (mode == SYSTEM_MODE::PROD) {
4343
//TODO(Jng468) placeholder
4444
} else if (mode == SYSTEM_MODE::DEV) {
45-
default_port = LOCAL_TRANSCEIVER_TEST_PORT;
45+
default_port = LOCAL_TRANSCEIVER_TEST_PORT;
46+
std::string run_iridium_cmd = "$ROS_WORKSPACE/scripts/run_virtual_iridium.sh";
47+
int result = std::system(run_iridium_cmd.c_str()); //NOLINT(concurrency-mt-unsafe)
48+
if (result != 0) {
49+
std::string msg = "Error: could not start virtual iridium";
50+
std::cerr << msg << std::endl;
51+
throw std::exception();
52+
}
53+
std::string set_baud_cmd = "stty 19200 < $LOCAL_TRANSCEIVER_TEST_PORT";
54+
result = std::system(set_baud_cmd.c_str()); //NOLINT(concurrency-mt-unsafe)
55+
if (result != 0) {
56+
std::string msg = "Error: could not set baud rate for virtual iridium";
57+
std::cerr << msg << std::endl;
58+
throw std::exception();
59+
}
60+
4661
} else {
4762
std::string msg = "Error, invalid system mode" + mode;
4863
throw std::runtime_error(msg);

0 commit comments

Comments
 (0)