Skip to content

Commit

Permalink
add option to connect oscheadtracker to existing external WLAN
Browse files Browse the repository at this point in the history
  • Loading branch information
gisogrimm committed Oct 25, 2023
1 parent e5990d3 commit 1c08aea
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
10 changes: 10 additions & 0 deletions manual/actmodoscheadtracker.tex
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
\hline
\indattr{combinegyr} & Combine quaternions with gyroscope based second estimate for increased resolution of pose estimation. (bool) & true\\
\hline
\indattr{connectwlan} & connect to sensor to external WLAN (bool) & false\\
\hline
\indattr{eogpath} & OSC target path for EOG data, or empty for no EOG (string) & \\
\hline
\indattr{name} & Prefix in OSC control variables (string) & oscheadtracker\\
\hline
\indattr{rotpath} & OSC target path for rotation data (string) & \\
Expand All @@ -32,10 +36,16 @@
\hline
\indattr{smooth} & Filter coefficient for smoothing of quaternions (double) & 0.1\\
\hline
\indattr{targetip} & target IP address when using external WLAN (string) & \\
\hline
\indattr{ttl} & Time-to-live of OSC multicast data (uint32) & 1\\
\hline
\indattr{url} & Target URL for OSC data logging, or empty for no datalogging (string) & \\
\hline
\indattr{wlanpass} & passphrase of external WLAN (string) & \\
\hline
\indattr{wlanssid} & SSID of external WLAN (string) & \\
\hline
\end{tabularx}
}
\end{snugshade}
31 changes: 26 additions & 5 deletions plugins/src/tascarmod_oscheadtracker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ class oscheadtracker_t : public TASCAR::actor_module_t {
bool combinegyr = true;
// time-to-live for multicast messages, if using multicast targets:
uint32_t ttl;
// connect to sensor to external WLAN:
bool connectwlan = false;
// SSID of external WLAN:
std::string wlanssid;
// password of external WLAN:
std::string wlanpass;
// target IP address when using external WLAN:
std::string targetip;

bool apply_loc = false;
bool apply_rot = true;
double autoref = 0.00001;
Expand Down Expand Up @@ -107,11 +116,16 @@ void oscheadtracker_t::configure()

void oscheadtracker_t::connect()
{
lo_send(headtrackertarget, "/connect", "is", session->get_srv_port(),
std::string("/" + name + "/quatrot").c_str());
if(!eogpath.empty()) {
lo_send(headtrackertarget, "/eog/connect", "is", session->get_srv_port(),
eogpath.c_str());
if(connectwlan) {
lo_send(headtrackertarget, "/wlan/connect", "sssi", wlanssid.c_str(),
wlanpass.c_str(), targetip.c_str(), session->get_srv_port());
} else {
lo_send(headtrackertarget, "/connect", "is", session->get_srv_port(),
std::string("/" + name + "/quatrot").c_str());
if(!eogpath.empty()) {
lo_send(headtrackertarget, "/eog/connect", "is", session->get_srv_port(),
eogpath.c_str());
}
}
}

Expand Down Expand Up @@ -153,6 +167,13 @@ oscheadtracker_t::oscheadtracker_t(const TASCAR::module_cfg_t& cfg)
apply_loc, "Apply translation based on accelerometer (not implemented)");
GET_ATTRIBUTE_BOOL(apply_rot,
"Apply rotation based on gyroscope and accelerometer");
GET_ATTRIBUTE_BOOL(connectwlan, "connect to sensor to external WLAN");
GET_ATTRIBUTE(wlanssid, "", "SSID of external WLAN");
GET_ATTRIBUTE(wlanpass, "", "passphrase of external WLAN");
GET_ATTRIBUTE(targetip, "", "target IP address when using external WLAN");
if(connectwlan && (wlanssid.size() == 0))
throw TASCAR::ErrMsg(
"If sensor is to be connected to WLAN, the SSID must be provided");
if(url.size()) {
target = lo_address_new_from_url(url.c_str());
if(!target)
Expand Down

0 comments on commit 1c08aea

Please sign in to comment.