Skip to content

Commit

Permalink
v1.17.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Allen committed Nov 11, 2019
1 parent 9e2670e commit a3aa833
Show file tree
Hide file tree
Showing 69 changed files with 360 additions and 543 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Cepton SDK Release Notes

## Version 1.17.3 2019-11-11

- Fix timed frame detection bug with timestamp jumps.
- Minor CeptonViewer fixes.

## Version 1.17.2 2019-11-02

- Minor CeptonViewer fixes.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.17.2
1.17.3
Binary file modified bin/linux-aarch64/CeptonViewer
Binary file not shown.
Binary file modified bin/linux-x86_64/CeptonViewer
Binary file not shown.
Binary file modified bin/osx/CeptonViewer.app/Contents/MacOS/CeptonViewer
Binary file not shown.
Binary file modified bin/win64/CeptonViewer.exe
Binary file not shown.
Binary file modified bin/win64/cepton_sdk.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion csharp/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.17.2
1.17.3
6 changes: 3 additions & 3 deletions csharp/cepton_cs_sdk/CaptureReplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private static void _E(SensorErrorCode ec)
private static extern SensorErrorCode _Close();

[DllImport("cepton_sdk.dll", EntryPoint = "cepton_sdk_capture_replay_get_start_time")]
private static extern ulong _GetStartTime();
private static extern long _GetStartTime();

[DllImport("cepton_sdk.dll", EntryPoint = "cepton_sdk_capture_replay_get_position")]
private static extern float _GetStartPosition();
Expand Down Expand Up @@ -69,7 +69,7 @@ private static void _E(SensorErrorCode ec)
public static void Rewind() { _E(_Rewind()); }
public static void Seek(float position) { _E(_Seek(position)); }
public static void SeekRelative(float position) { Seek(StartPosition + position); }
public static void EnableLoop(bool enabled) { }
public static void EnableLoop(bool enabled) { _E(_EnableLoop(enabled)); }

public static bool IsOpen => _IsOpen();
public static bool IsEnd => _IsEnd();
Expand All @@ -85,7 +85,7 @@ public static float Speed
set { _E(_SetSpeed(value)); }
}

public static ulong StartTime => _GetStartTime();
public static long StartTime => _GetStartTime();
public static float StartPosition => _GetStartPosition();
public static float CaptureLength => _GetLength();
}
Expand Down
2 changes: 1 addition & 1 deletion csharp/cepton_cs_sdk/CeptonSDK.cs
Original file line number Diff line number Diff line change
Expand Up @@ -363,4 +363,4 @@ public static Sensor GetSensor(ulong serial_number) =>

public static float GetFrameLength() => _GetFrameLength();
}
}
}
Binary file modified csharp/cepton_cs_sdk/cepton_sdk.dll
Binary file not shown.
Binary file modified docs/cepton_sdk.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion include/cepton_sdk_impl/cepton_sdk_util.inc
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ bool TimedFrameDetector<TData>::update(const SensorImagePoint &point,
const TData &data) {
if (m_t == 0) m_t = point.timestamp;
const float t_diff = from_usec(point.timestamp - m_t);
if (t_diff < frame_length) return false;
if ((t_diff < frame_length) && (t_diff > -0.01f)) return false;

m_t = 0;

Expand Down
Binary file modified lib/linux-aarch64/libcepton_sdk.a
Binary file not shown.
Binary file modified lib/linux-aarch64/libcepton_sdk.so
Binary file not shown.
Binary file modified lib/linux-arm/libcepton_sdk.a
Binary file not shown.
Binary file modified lib/linux-arm/libcepton_sdk.so
Binary file not shown.
Binary file modified lib/linux-i386/libcepton_sdk.a
Binary file not shown.
Binary file modified lib/linux-i386/libcepton_sdk.so
Binary file not shown.
Binary file modified lib/linux-x86_64/libcepton_sdk.a
Binary file not shown.
Binary file modified lib/linux-x86_64/libcepton_sdk.so
Binary file not shown.
Binary file modified lib/osx/libcepton_sdk.a
Binary file not shown.
Binary file modified lib/osx/libcepton_sdk.dylib
Binary file not shown.
Binary file modified lib/win64/cepton_sdk.lib
Binary file not shown.
2 changes: 1 addition & 1 deletion matlab/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.17.2
1.17.3
Binary file modified matlab/cepton_sdk.mltbx
Binary file not shown.
2 changes: 1 addition & 1 deletion matlab/include/cepton_sdk_impl/cepton_sdk_util.inc
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ bool TimedFrameDetector<TData>::update(const SensorImagePoint &point,
const TData &data) {
if (m_t == 0) m_t = point.timestamp;
const float t_diff = from_usec(point.timestamp - m_t);
if (t_diff < frame_length) return false;
if ((t_diff < frame_length) && (t_diff > -0.01f)) return false;

m_t = 0;

Expand Down
Binary file modified matlab/lib/linux-aarch64/libcepton_sdk_matlab.so
Binary file not shown.
Binary file modified matlab/lib/linux-arm/libcepton_sdk_matlab.so
Binary file not shown.
Binary file modified matlab/lib/linux-i386/libcepton_sdk_matlab.so
Binary file not shown.
Binary file modified matlab/lib/linux-x86_64/libcepton_sdk_matlab.so
Binary file not shown.
Binary file modified matlab/lib/osx/libcepton_sdk_matlab.dylib
Binary file not shown.
Binary file modified matlab/lib/win64/cepton_sdk_matlab.dll
Binary file not shown.
5 changes: 2 additions & 3 deletions python/cepton_sdk/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,9 @@ def open_replay(capture_path, capture_seek=0, enable_loop=False, enable_wait=Fal
cepton_sdk.capture_replay.close()
cepton_sdk.capture_replay.open(capture_path)
cepton_sdk.capture_replay.set_enable_loop(enable_loop)

if enable_wait:
cepton_sdk.capture_replay.resume_blocking(3)
cepton_sdk.capture_replay.seek(capture_seek)
cepton_sdk.capture_replay.seek(capture_seek)


close_replay = cepton_sdk.capture_replay.close
Expand Down Expand Up @@ -136,7 +135,7 @@ def _wait_on_func(func, timeout=None):
if timeout is not None:
t_start = get_timestamp()
while not func():
wait(0.001)
wait(0.1)
if timeout is not None:
if (get_timestamp() - t_start) > timeout:
raise RuntimeError("Timed out!")
Expand Down
Binary file modified python/cepton_sdk/lib/linux-aarch64/libcepton_sdk.so
Binary file not shown.
Binary file modified python/cepton_sdk/lib/linux-arm/libcepton_sdk.so
Binary file not shown.
Binary file modified python/cepton_sdk/lib/linux-i386/libcepton_sdk.so
Binary file not shown.
Binary file modified python/cepton_sdk/lib/linux-x86_64/libcepton_sdk.so
Binary file not shown.
Binary file modified python/cepton_sdk/lib/osx/libcepton_sdk.dylib
Binary file not shown.
Binary file modified python/cepton_sdk/lib/win64/cepton_sdk.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion python/cepton_util/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.17.2
1.17.3
108 changes: 73 additions & 35 deletions python/cepton_util/capture.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import datetime
import glob
import ipaddress
import platform
import shutil
import glob
import subprocess
import sys

import netifaces
import serial.tools.list_ports

from cepton_util.common import *

Expand All @@ -26,22 +29,66 @@ def length(self):
return get_timestamp() - self.start_time


def get_all_camera_devices():
if sys.platform.startswith("linux"):
return sorted(glob.glob("/dev/video[0-9]"))
else:
raise NotImplementedError("OS not supported!")


class CameraCapture(CaptureBase):
def __init__(self, video_device, output_path, video_size="1280x720", **kwargs):
if shutil.which("dumpcap") is None:
raise OSError("Cannot find ffmpeg!")
if not sys.platform.startswith("linux"):
raise NotImplementedError("OS not supported!")

super().__init__(**kwargs)

cmd_list = [
"ffmpeg",
"-loglevel", "error", # Quiet
"-nostdin", # Disable capturing keyboard
"-y", # Overwrite
"-f", "v4l2",
"-video_size", video_size, # Video size
"-input_format", "mjpeg", # Video codec
"-ts", "mono2abs",
"-i", str(video_device),
"-c:v", "copy", # Copy video codec
"-an", # No audio
"-copyts", # Copy timestamps
output_path,
]
options = {
"background": True,
}
self._proc = execute_command(cmd_list, **options)

def close(self):
try:
self._proc.close()
except:
pass
self._proc = None


def find_network_interface():
interfaces = []
for interface in netifaces.interfaces():
try:
if netifaces.ifaddresses(interface)[netifaces.AF_INET][0]["broadcast"] == "192.168.255.255":
interfaces.append(interface)
except:
continue
continue
if len(interfaces) == 0:
raise RuntimeError("No network interface found!")
if len(interfaces) > 1:
raise RuntimeError("Multiple network interfaces found!")
return interfaces[0]


class PCAPCapture(CaptureBase):
class NetworkCapture(CaptureBase):
def __init__(self, output_path, interface=None, **kwargs):
if shutil.which("dumpcap") is None:
raise RuntimeError("Cannot find dumpcap!")
Expand Down Expand Up @@ -72,37 +119,26 @@ def close(self):
self._proc = None


def get_all_camera_devices():
if sys.platform.startswith("linux"):
return sorted(glob.glob("/dev/video[0-9]"))
else:
raise NotImplementedError("OS not supported!")
def get_all_ros_topics():
try:
return sorted(subprocess.check_output(["rostopic", "list"]).decode("utf-8").split())
except:
return []


class CameraCapture(CaptureBase):
def __init__(self, video_device, output_path, video_size="1280x720", **kwargs):
if shutil.which("dumpcap") is None:
raise OSError("Cannot find ffmpeg!")
if not sys.platform.startswith("linux"):
raise NotImplementedError("OS not supported!")
class ROSCapture(CaptureBase):
def __init__(self, ros_topics, output_path, **kwargs):
if shutil.which("rosbag") is None:
raise OSError("Cannot find rosbag!")

super().__init__(**kwargs)

cmd_list = [
"ffmpeg",
"-loglevel", "error", # Quiet
"-nostdin", # Disable capturing keyboard
"-y", # Overwrite
"-f", "v4l2",
"-video_size", video_size, # Video size
"-input_format", "mjpeg", # Video codec
"-ts", "mono2abs",
"-i", str(video_device),
"-c:v", "copy", # Copy video codec
"-an", # No audio
"-copyts", # Copy timestamps
output_path,
"rosbag", "record",
"--lz4",
"-O", output_path,
]
cmd_list.extend(ros_topics)
options = {
"background": True,
}
Expand All @@ -116,21 +152,23 @@ def close(self):
self._proc = None


class BagCapture(CaptureBase):
def __init__(self, ros_topics, output_path, **kwargs):
if shutil.which("rosbag") is None:
raise OSError("Cannot find rosbag!")
def get_all_serial_ports():
return sorted([x.device for x in serial.tools.list_ports.comports()])


class SerialCapture(CaptureBase):
def __init__(self, port, output_path, **kwargs):
if not platform.startswith("linux"):
raise OSError("Unsupported platform!")

super().__init__(**kwargs)

cmd_list = [
"rosbag", "record",
"--lz4",
"-O", output_path,
"(stty raw; cat > {}) < {}".format(output_path, port)
]
cmd_list.extend(ros_topics)
options = {
"background": True,
"shell": True,
}
self._proc = execute_command(cmd_list, **options)

Expand Down
62 changes: 37 additions & 25 deletions python/cepton_util/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,10 +505,6 @@ def clear(self):


class DataDirectoryMixin:
@classmethod
def default_camera_name(self, i):
return "camera_{}.mkv".format(i)

def _get_path(self, name):
if self.path is None:
return None
Expand All @@ -517,9 +513,6 @@ def _get_path(self, name):
def __bool__(self):
return self.path is not None

def default_camera_path(self, i):
return self._get_path(self.default_camera_name(i))


class InputDataDirectory(DataDirectoryMixin):
def __init__(self, path=None):
Expand All @@ -537,13 +530,6 @@ def _find_file(self, path):
return path
return None

@property
def camera_paths(self):
return glob.glob(os.path.join(self.path, "camera_[0-9].mkv"))

def camera_path(self, i):
return self._find_file(self.default_camera_path(i))


def copy_settings(src, dst):
if src == dst:
Expand All @@ -556,12 +542,11 @@ def copy_settings(src, dst):


class OutputDataDirectory(DataDirectoryMixin, ArgumentParserMixin):
def __init__(self, path=None, duration=None, name="", postfix="", root_dir="~/Captures"):
def __init__(self, path=None, duration=None, postfix="", root_dir="~/Captures"):
self.duration = duration

if path is None:
self.name = os.path.join(
get_day_str(), name, get_sec_str() + postfix)
self.name = os.path.join(get_day_str(), get_sec_str() + postfix)
self.path = fix_path(os.path.join(root_dir, self.name))
else:
self.name = os.path.basename(path)
Expand All @@ -572,7 +557,6 @@ def __init__(self, path=None, duration=None, name="", postfix="", root_dir="~/Ca
def add_arguments(cls, parser):
group = parser.add_argument_group("OutputDataDirectory")
group.add_argument("--duration", help="Capture duration.")
group.add_argument("--name", default="", help="Capture name.")
return group

@classmethod
Expand All @@ -588,9 +572,6 @@ def copy_settings(self, input_path=None):
input_path = os.getcwd()
copy_settings(input_path, self.path)

def camera_path(self, i):
return self.default_camera_path(i)

def wait(self):
if self.duration is None:
wait_for_input()
Expand Down Expand Up @@ -620,17 +601,48 @@ def output_path_func(self):
name), property(output_path_func))


_add_data_directory_path("alg_settings", "cepton_alg_config.json")
_add_data_directory_path("bag", "ros.bag")
_add_data_directory_path("clips", "cepton_clips.json")
_add_data_directory_path("gps", "gps.txt")
_add_data_directory_path("imu", "imu.txt")
_add_data_directory_path("odometry", "odometry.txt")
_add_data_directory_path("pcap", "lidar.pcap")
_add_data_directory_path("network", "lidar.pcap")
_add_data_directory_path("player_settings", "cepton_player_config.json")
_add_data_directory_path("render_settings", "cepton_render_config.json")
_add_data_directory_path("ros", "ros.bag")
_add_data_directory_path("rviz_config", "rviz_config.rviz")
_add_data_directory_path("transforms", "cepton_transforms.json")
_add_data_directory_path("viewer_config", "cepton_viewer_config.json")


def _add_data_directory_multi_path(name, path):
default_name_member = "default_{}_name".format(name)

@classmethod
def default_name_func(cls, i):
return path.format(i)
setattr(DataDirectoryMixin, default_name_member, default_name_func)

def default_path_func(self, i):
return self._get_path(getattr(self, default_name_member)(i))
default_path_member = "default_{}_path".format(name)
setattr(DataDirectoryMixin, default_path_member, default_path_func)

def input_paths_func(self):
if self.path is None:
return []
return glob.glob(os.path.join(self.path, path.format("[0-9]")))
setattr(InputDataDirectory, "{}_paths".format(name), input_paths_func)

def input_path_func(self, i):
return self._find_file(getattr(self, default_path_member)(i))
setattr(InputDataDirectory, "{}_path".format(name), input_path_func)

def output_path_func(self, i):
return getattr(self, default_path_member)(i)
setattr(OutputDataDirectory, "{}_path".format(name), output_path_func)


_add_data_directory_multi_path("camera", "camera_{}.mkv")
_add_data_directory_multi_path("serial", "serial_{}.mkv")


__all__ = _all_builder.get()
Empty file.
Loading

0 comments on commit a3aa833

Please sign in to comment.