Skip to content

Commit

Permalink
update for ZED SDK 4.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
adujardin committed May 27, 2024
1 parent 92210d0 commit b30caa9
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 19 deletions.
4 changes: 1 addition & 3 deletions body tracking/multi-camera/cpp/src/ClientPublisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ bool ClientPublisher::open(sl::InputType input) {
sl::InitParameters init_parameters;
init_parameters.depth_mode = sl::DEPTH_MODE::ULTRA;
init_parameters.input = input;
if (input.getType() == sl::InputType::INPUT_TYPE::SVO_FILE)
init_parameters.svo_real_time_mode = true;
init_parameters.coordinate_units = sl::UNIT::METER;
init_parameters.coordinate_system = sl::COORDINATE_SYSTEM::RIGHT_HANDED_Y_UP;
auto state = zed.open(init_parameters);
Expand Down Expand Up @@ -94,11 +92,11 @@ void ClientPublisher::work()
// just be sure to run the bodies detection
zed.retrieveBodies(bodies, body_runtime_parameters);
}
sl::sleep_ms(2);
}
}

void ClientPublisher::setStartSVOPosition(unsigned pos) {
zed.setSVOPosition(pos);
zed.grab();
}

6 changes: 2 additions & 4 deletions body tracking/multi-camera/cpp/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,6 @@ int main(int argc, char **argv) {
std::map<sl::CameraIdentifier, sl::Mat> pointClouds;
sl::Resolution low_res(512,360);

bool new_data = false;
sl::Timestamp ts_new_data = sl::Timestamp(0);

// run the fusion as long as the viewer is available.
while (viewer.isAvailable()) {
// run the fusion process (which gather data from all camera, sync them and process them)
Expand All @@ -177,7 +174,8 @@ int main(int argc, char **argv) {
}
// update the 3D view
viewer.updateBodies(fused_bodies, camera_raw_data, metrics);
std::this_thread::sleep_for(std::chrono::microseconds(10));

sl::sleep_ms(10);
}

viewer.exit();
Expand Down
2 changes: 1 addition & 1 deletion global localization/live/python/display/gl_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def print_text(self):
start_w = 20
start_h = h_wnd - 40

if(self.trackState == sl.POSITIONAL_TRACKING_STATE.OK):
if(self.trackState != sl.POSITIONAL_TRACKING_FUSION_STATUS.UNAVAILABLE):
glColor3f(0.2, 0.65, 0.2)
else:
glColor3f(0.85, 0.2, 0.2)
Expand Down
14 changes: 6 additions & 8 deletions global localization/playback/python/display/generic_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ def __init__(self):
def __del__(self):
closeAllKMLFiles()

def init(self,camera_model):
def init(self, camera_model):
self.glviewer = GLViewer()
self.glviewer.init(camera_model)
# Replace this part with the appropriate connection to your IoT system

def updatePoseData(self, zed_rt,str_t,str_r, state):
self.glviewer.updateData(zed_rt,str_t,str_r, state)
def updatePoseData(self, zed_rt, str_t, str_r, state):
self.glviewer.updateData(zed_rt, str_t, str_r, state)

def isAvailable(self):
return self.glviewer.is_available()
Expand All @@ -41,10 +41,8 @@ def updateGeoPoseData(self, geo_pose, current_timestamp):
current_timestamp.get_milliseconds()))

gnss_data = {}
gnss_data["longitude"] = geo_pose.latlng_coordinates.get_latitude(
False)
gnss_data["latitude"] = geo_pose.latlng_coordinates.get_latitude(
False)
gnss_data["longitude"] = geo_pose.latlng_coordinates.get_latitude(False)
gnss_data["latitude"] = geo_pose.latlng_coordinates.get_latitude(False)
gnss_data["altitude"] = geo_pose.latlng_coordinates.get_altitude()
saveKMLData("fused_position.kml", gnss_data)

Expand All @@ -58,7 +56,7 @@ def updateGeoPoseData(self, geo_pose, current_timestamp):

try:
while True:
# Votre logique ici...
# Your logic here...
pass
except KeyboardInterrupt:
pass
6 changes: 5 additions & 1 deletion global localization/playback/python/display/gl_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,11 @@ def print_text(self):
start_w = 20
start_h = h_wnd - 40

glColor3f(0.2, 0.65, 0.2)
if(self.trackState == sl.POSITIONAL_TRACKING_STATE.OK):
glColor3f(0.2, 0.65, 0.2)
else:
glColor3f(0.85, 0.2, 0.2)

glRasterPos2i(start_w, start_h)

safe_glutBitmapString(GLUT_BITMAP_HELVETICA_18, "POSITIONAL TRACKING : " + str(self.trackState))
Expand Down
2 changes: 1 addition & 1 deletion global localization/recording/python/display/gl_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def print_text(self):
start_w = 20
start_h = h_wnd - 40

if(self.trackState == sl.POSITIONAL_TRACKING_STATE.OK):
if(self.trackState != sl.POSITIONAL_TRACKING_FUSION_STATUS.UNAVAILABLE):
glColor3f(0.2, 0.65, 0.2)
else:
glColor3f(0.85, 0.2, 0.2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def print_text(self):
start_w = 20
start_h = h_wnd - 40

if(self.trackState == sl.POSITIONAL_TRACKING_STATE.OK):
if(self.trackState != sl.POSITIONAL_TRACKING_FUSION_STATUS.UNAVAILABLE):
glColor3f(0.2, 0.65, 0.2)
else:
glColor3f(0.85, 0.2, 0.2)
Expand Down

0 comments on commit b30caa9

Please sign in to comment.