-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* dev config for SITL * add readme network command * add integration test for airdrop conn * fix default network mode host * fix lint
- Loading branch information
1 parent
8439d0c
commit 1e1f9f3
Showing
10 changed files
with
126 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FROM amd64/ubuntu:22.04 | ||
|
||
# set up user | ||
ARG USERNAME=tuas USER_UID=1000 USER_GID=1000 DEBIAN_FRONTEND=noninteractive | ||
RUN groupadd -f --gid $USER_GID $USERNAME \ | ||
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME | ||
RUN usermod -a -G dialout $USERNAME | ||
|
||
USER $USERNAME | ||
|
||
# Steps from https://ardupilot.org/dev/docs/building-setup-linux.html#building-setup-linux | ||
|
||
WORKDIR /home/$USERNAME | ||
|
||
RUN sudo apt-get update && sudo apt-get install git && sudo apt-get install git | ||
RUN git clone --recurse-submodules https://github.com/ArduPilot/ardupilot.git | ||
|
||
WORKDIR ./ardupilot | ||
|
||
RUN Tools/environment_install/install-prereqs-ubuntu.sh -y | ||
RUN source ~/.profile | ||
|
||
# wipe parameters | ||
RUN timeout 3 ./sim_vehicle.py -w | ||
|
||
ENTRYPOINT ./sim_vehicle.py -v ArduPlane -f quadplane --console --map |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#include <thread> | ||
#include <chrono> | ||
|
||
extern "C" { | ||
#include "airdrop/packet.h" | ||
#include "network/airdrop_sockets.h" | ||
} | ||
|
||
#include "network/airdrop_client.hpp" | ||
#include "utilities/logging.hpp" | ||
|
||
using namespace std::chrono_literals; | ||
|
||
int main(int argc, char** argv) { | ||
initLogging("/workspaces/obcpp/logs", true, argc, argv); | ||
|
||
ad_socket_result_t result = make_ad_socket(AD_OBC_PORT, AD_PAYLOAD_PORT); | ||
|
||
if (result.is_err) { | ||
std::cerr << "SOCKET ERROR: " << result.data.err << std::endl; | ||
std::exit(1); | ||
} | ||
|
||
AirdropClient airdrop(result.data.res); | ||
airdrop.send(ad_latlng_packet_t {.hdr=SEND_LATLNG, .bottle=BOTTLE_A, .lat=32.12345, .lng=76.98765}); | ||
std::this_thread::sleep_for(5s); | ||
LOG_F(INFO, "Checking for ack latlng..."); | ||
while (true) { | ||
auto packet = airdrop.receive(); | ||
if (!packet) { | ||
break; | ||
} | ||
LOG_F(INFO, "test %d %d", static_cast<int>(packet->data), static_cast<int>(packet->hdr)); | ||
} | ||
LOG_F(INFO, "Done with checking for ack latlng"); | ||
airdrop.send(ad_packet_t {.hdr=SIGNAL, .data=BOTTLE_A}); | ||
std::this_thread::sleep_for(1s); | ||
while (true) { | ||
auto packet = airdrop.receive(); | ||
if (!packet) { | ||
break; | ||
} | ||
LOG_F(INFO, "test2 %d %d", static_cast<int>(packet->data), static_cast<int>(packet->hdr)); | ||
} | ||
airdrop.send(ad_packet_t {.hdr=REVOKE, .data=BOTTLE_A}); | ||
std::this_thread::sleep_for(1s); | ||
while (true) { | ||
auto packet = airdrop.receive(); | ||
if (!packet) { | ||
break; | ||
} | ||
LOG_F(INFO, "test2 %d %d", static_cast<int>(packet->data), static_cast<int>(packet->hdr)); | ||
} | ||
|
||
while (true) { | ||
std::cout << "stop\n"; | ||
std::this_thread::sleep_for(1s); | ||
} | ||
} |