Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from org.glassfish.jaxb:jaxb-runtime:2.3.3 to com.sun.xml.bind… #336

Merged
merged 9 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example-simulations/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ihmc {
}

mainDependencies {
api("us.ihmc:ihmc-robot-data-logger:0.29.1")
api("us.ihmc:ihmc-robot-data-logger:0.29.3")
api("us.ihmc:ihmc-common-walking-control-modules:source")
api("us.ihmc:ihmc-whole-body-controller:source")

Expand Down
2 changes: 1 addition & 1 deletion ihmc-avatar-interfaces/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mainDependencies {
api("com.hierynomus:sshj:0.32.0")

api("us.ihmc:mecano-graphviz:17-0.18.1")
api("us.ihmc:scs2-bullet-simulation:17-0.26.0")
api("us.ihmc:scs2-bullet-simulation:17-0.27.0")

api("us.ihmc:ihmc-humanoid-behaviors:source")
api("us.ihmc:ihmc-graphics-jmonkeyengine:source")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public void updateInternal()

private void detectFromVideoPacket(VideoPacket videoPacket)
{
BufferedImage bufferedImage = jpegDecompressor.decompressJPEGDataToBufferedImage(videoPacket.getData().toArray());
BufferedImage bufferedImage = jpegDecompressor.decompressJPEGDataToBufferedImage(videoPacket.getData().copyArray());
detect(bufferedImage,
videoPacket.getPosition(),
videoPacket.getOrientation(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.net.MalformedURLException;
import java.util.ArrayList;

import javax.xml.bind.JAXBException;
import jakarta.xml.bind.JAXBException;

import us.ihmc.euclid.referenceFrame.ReferenceFrame;
import us.ihmc.euclid.referenceFrame.tools.ReferenceFrameTools;
Expand Down
2 changes: 1 addition & 1 deletion ihmc-common-walking-control-modules/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ testDependencies {
visualizersDependencies {
api(ihmc.sourceSetProject("main"))
api("us.ihmc:simulation-construction-set:0.25.1")
api("us.ihmc:scs2-simulation-construction-set:17-0.26.0")
api("us.ihmc:scs2-simulation-construction-set:17-0.27.0")

var javaFXVersion = "17.0.9"
api(ihmc.javaFXModule("base", javaFXVersion))
Expand Down
4 changes: 2 additions & 2 deletions ihmc-communication/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ihmc {
mainDependencies {
api("us.ihmc:ihmc-realtime:1.6.0")
api("us.ihmc:ihmc-video-codecs:2.1.6")
api("us.ihmc:ihmc-ros2-library:0.24.2")
api("us.ihmc:ihmc-ros2-library:0.24.3")
api("org.boofcv:boofcv-geo:0.36")
api("commons-net:commons-net:3.6")
api("org.lz4:lz4-java:1.8.0")
Expand All @@ -27,5 +27,5 @@ mainDependencies {

testDependencies {
api("us.ihmc:ihmc-robotics-toolkit-test:source")
api("us.ihmc:ihmc-ros2-library-test:0.24.2")
api("us.ihmc:ihmc-ros2-library-test:0.24.3")
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import gnu.trove.list.array.TByteArrayList;
import us.ihmc.euclid.tuple3D.Point3D;
import us.ihmc.euclid.tuple4D.Quaternion;
import us.ihmc.idl.IDLSequence;

public class StereoVisionPointCloudMessageSerializer extends Serializer<StereoVisionPointCloudMessage>
{
Expand Down Expand Up @@ -41,8 +42,8 @@ public void write(Kryo kryo, Output output, StereoVisionPointCloudMessage object
output.writeDouble(pointCloudCenter.getZ());
output.writeDouble(object.getResolution());
output.writeInt(object.getNumberOfPoints(), true);
writeTByteList(object.getPointCloud());
writeTByteList(object.getColors());
writeByteSequence(object.getPointCloud());
writeByteSequence(object.getColors());
output.writeBoolean(object.getLz4Compressed());
}

Expand All @@ -62,15 +63,12 @@ public StereoVisionPointCloudMessage read(Kryo kryo, Input input, Class<? extend
message.getPointCloudCenter().set(input.readDouble(), input.readDouble(), input.readDouble());
message.setResolution(input.readDouble());
message.setNumberOfPoints(input.readInt(true));
readTByteList(message.getPointCloud());
readTByteList(message.getColors());
readByteSequence(message.getPointCloud());
readByteSequence(message.getColors());
message.setLz4Compressed(input.readBoolean());
return message;
}

private final Field tByteArrayListDataField = getField("_data");
private final Field tByteArrayListPosField = getField("_pos");

private static Field getField(String fieldName)
{
Field field;
Expand All @@ -86,30 +84,26 @@ private static Field getField(String fieldName)
}
}

private void writeTByteList(TByteArrayList list)
private void writeByteSequence(IDLSequence.Byte byteSequence)
{
output.writeInt(list.size(), true);
output.writeInt(byteSequence.size(), true);
try
{
byte[] data = (byte[]) tByteArrayListDataField.get(list);
output.write(data, 0, list.size());
output.write(byteSequence.getBuffer().array(), 0, byteSequence.size());
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}

private void readTByteList(TByteArrayList list)
private void readByteSequence(IDLSequence.Byte byteSequence)
{
list.resetQuick();
byteSequence.resetQuick();
int size = input.readInt(true);
list.ensureCapacity(size);
try
{
byte[] data = (byte[]) tByteArrayListDataField.get(list);
input.read(data, 0, size);
tByteArrayListPosField.set(list, size);
input.read(byteSequence.getBuffer().array(), 0, size);
}
catch (Exception e)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package us.ihmc.communication.packets;

import perception_msgs.msg.dds.LidarScanMessage;
import gnu.trove.list.array.TByteArrayList;
import net.jpountz.lz4.LZ4Exception;
import us.ihmc.communication.compression.LZ4CompressionImplementation;
import us.ihmc.idl.IDLSequence;

import java.nio.ByteBuffer;
import java.nio.IntBuffer;
Expand Down Expand Up @@ -69,11 +69,11 @@ public static void compressPointCloud(int pointCloudSize, LidarScanMessage messa
messageToPack.setNumberOfPoints(pointCloudSize);
}

public static void decompressPointCloud(TByteArrayList compressedPointCloud,
public static void decompressPointCloud(IDLSequence.Byte compressedPointCloud,
int numberOfPoints,
LidarPointConsumer pointCoordinateConsumer)
{
ByteBuffer compressedPointCloudByteBuffer = ByteBuffer.wrap(compressedPointCloud.toArray());
ByteBuffer compressedPointCloudByteBuffer = compressedPointCloud.copyByteBuffer();
int numberOfDecompressedBytes = numberOfPoints * 4 * 3;
ByteBuffer decompressedPointCloudByteBuffer = ByteBuffer.allocate(numberOfDecompressedBytes);
compressorThreadLocal.get().decompress(compressedPointCloudByteBuffer, decompressedPointCloudByteBuffer, numberOfDecompressedBytes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,7 @@ public static void packPrivilegedJointAngles(KinematicsToolboxPrivilegedConfigur

public static void packScan(LidarScanMessage lidarScanMessage, Point3DReadOnly[] scan)
{
lidarScanMessage.getScan().reset();
lidarScanMessage.getScan().resetQuick();
LidarPointCloudCompression.compressPointCloud(scan.length, lidarScanMessage, (i, j) -> scan[i].getElement(j));
}

Expand Down Expand Up @@ -1491,17 +1491,17 @@ public static Bool createBoolMessage(boolean data)
*/
public static void packLongStringToByteSequence(String longString, IDLSequence.Byte byteSequence)
{
byteSequence.clear();
byteSequence.resetQuick();
byte[] longStringBytes = longString.getBytes(StandardCharsets.US_ASCII);
byteSequence.addAll(longStringBytes);
byteSequence.add(longStringBytes);
}

/**
* See {@link #unpackLongStringFromByteSequence(IDLSequence.Byte)}.
*/
public static String unpackLongStringFromByteSequence(IDLSequence.Byte byteSequence)
{
byte[] longStringData = byteSequence.toArray();
byte[] longStringData = byteSequence.copyArray();
return new String(longStringData, StandardCharsets.US_ASCII);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import java.nio.ByteBuffer;

import controller_msgs.msg.dds.StereoVisionPointCloudMessage;
import gnu.trove.list.array.TByteArrayList;
import net.jpountz.lz4.LZ4Exception;
import us.ihmc.communication.compression.LZ4CompressionImplementation;
import us.ihmc.euclid.tools.EuclidCoreTools;
import us.ihmc.euclid.tuple3D.Point3D;
import us.ihmc.euclid.tuple3D.Point3D32;
import us.ihmc.euclid.tuple3D.interfaces.Point3DBasics;
import us.ihmc.euclid.tuple3D.interfaces.Point3DReadOnly;
import us.ihmc.idl.IDLSequence;

/**
* This class should be used to create and unpack a {@link StereoVisionPointCloudMessage}.
Expand All @@ -31,8 +31,8 @@ public static class CompressionIntermediateVariablesPackage
private ByteBuffer rawColorByteBuffer;
private final LZ4CompressionImplementation compressor = new LZ4CompressionImplementation();

private ByteBufferedSequence byteBufferedPointCloud;
private ByteBufferedSequence byteBufferedColors;
private IDLSequence.Byte byteBufferedPointCloud;
private IDLSequence.Byte byteBufferedColors;
private ByteBuffer compressedPointCloudByteBuffer;
private ByteBuffer compressedColorByteBuffer;
private final StereoVisionPointCloudMessage message = new StereoVisionPointCloudMessage();
Expand All @@ -55,13 +55,13 @@ private void initialize(int numberOfPoints)
rawColorByteBuffer = ByteBuffer.allocate(colorByteBufferSize);

// LZ4 compression apparently needs some additional room to do its thing.
byteBufferedPointCloud = new ByteBufferedSequence(pointCloudByteBufferSize * 2, "type_9");
byteBufferedColors = new ByteBufferedSequence(colorByteBufferSize * 2, "type_9");
byteBufferedPointCloud = new IDLSequence.Byte(pointCloudByteBufferSize * 2, "type_9");
byteBufferedColors = new IDLSequence.Byte(colorByteBufferSize * 2, "type_9");

message.point_cloud_ = byteBufferedPointCloud;
message.colors_ = byteBufferedColors;
compressedPointCloudByteBuffer = byteBufferedPointCloud.byteBuffer;
compressedColorByteBuffer = byteBufferedColors.byteBuffer;
compressedPointCloudByteBuffer = byteBufferedPointCloud.getBuffer();
compressedColorByteBuffer = byteBufferedColors.getBuffer();
}
else
{
Expand All @@ -87,33 +87,8 @@ private void clearMessage()
message.getSensorOrientation().setToZero();
message.setResolution(0.0);
message.setNumberOfPoints(0);
message.getPointCloud().reset();
message.getColors().reset();
}
}

public static class ByteBufferedSequence extends us.ihmc.idl.IDLSequence.Byte
{
private ByteBuffer byteBuffer;

public ByteBufferedSequence(int maxSize, String typeCode)
{
super(maxSize, typeCode);
byteBuffer = ByteBuffer.wrap(this._data);
reset();
}

@Override
public void reset()
{
super.reset();
byteBuffer.clear();
byteBuffer.position(0);
}

public void setPosition(int position)
{
_pos = position;
message.getPointCloud().resetQuick();
message.getColors().resetQuick();
}
}

Expand Down Expand Up @@ -257,8 +232,8 @@ public static StereoVisionPointCloudMessage compressPointCloud(long timestamp,
colorByteBuffer.put(colorAccessor.getBlue(i));
}

variablesPackage.byteBufferedPointCloud.setPosition(variablesPackage.pointCloudByteBufferSize);
variablesPackage.byteBufferedColors.setPosition(variablesPackage.colorByteBufferSize);
variablesPackage.byteBufferedPointCloud.getBuffer().position(variablesPackage.pointCloudByteBufferSize);
variablesPackage.byteBufferedColors.getBuffer().position(variablesPackage.colorByteBufferSize);
}
else
{
Expand Down Expand Up @@ -303,8 +278,8 @@ public static StereoVisionPointCloudMessage compressPointCloud(long timestamp,
return null;
}

variablesPackage.byteBufferedPointCloud.setPosition(compressedPointCloudSize);
variablesPackage.byteBufferedColors.setPosition(compressedColorSize);
variablesPackage.byteBufferedPointCloud.getBuffer().position(compressedPointCloudSize);
variablesPackage.byteBufferedColors.getBuffer().position(compressedColorSize);
}

return message;
Expand All @@ -319,7 +294,7 @@ public static Point3D32[] decompressPointCloudToArray32(StereoVisionPointCloudMe
message.getLz4Compressed());
}

public static Point3D32[] decompressPointCloudToArray32(TByteArrayList compressedPointCloud,
public static Point3D32[] decompressPointCloudToArray32(IDLSequence.Byte compressedPointCloud,
Point3D center,
double resolution,
int numberOfPoints,
Expand All @@ -339,7 +314,7 @@ public static Point3D[] decompressPointCloudToArray(StereoVisionPointCloudMessag
message.getLz4Compressed());
}

public static Point3D[] decompressPointCloudToArray(TByteArrayList compressedPointCloud,
public static Point3D[] decompressPointCloudToArray(IDLSequence.Byte compressedPointCloud,
Point3D center,
double resolution,
int numberOfPoints,
Expand All @@ -360,7 +335,7 @@ public static void decompressPointCloud(StereoVisionPointCloudMessage message, P
pointCoordinateConsumer);
}

public static void decompressPointCloud(TByteArrayList compressedPointCloud,
public static void decompressPointCloud(IDLSequence.Byte compressedPointCloud,
Point3D center,
double resolution,
int numberOfPoints,
Expand All @@ -369,7 +344,7 @@ public static void decompressPointCloud(TByteArrayList compressedPointCloud,
{
if (isLZ4Compressed)
{
ByteBuffer compressedPointCloudByteBuffer = ByteBuffer.wrap(compressedPointCloud.toArray());
ByteBuffer compressedPointCloudByteBuffer = compressedPointCloud.copyByteBuffer();
ByteBuffer decompressedPointCloudByteBuffer = ByteBuffer.allocate(computePointByteBufferSize(numberOfPoints));
compressorThreadLocal.get().decompress(compressedPointCloudByteBuffer, decompressedPointCloudByteBuffer, computePointByteBufferSize(numberOfPoints));
decompressedPointCloudByteBuffer.flip();
Expand Down Expand Up @@ -405,7 +380,7 @@ public static Color[] decompressColorsToAWTColorArray(StereoVisionPointCloudMess
return decompressColorsToAWTColorArray(message.getColors(), message.getNumberOfPoints(), message.getLz4Compressed());
}

public static Color[] decompressColorsToAWTColorArray(TByteArrayList compressedColors, int numberOfPoints, boolean isLZ4Compressed)
public static Color[] decompressColorsToAWTColorArray(IDLSequence.Byte compressedColors, int numberOfPoints, boolean isLZ4Compressed)
{
Color[] colors = new Color[numberOfPoints];
decompressColors(compressedColors, numberOfPoints, isLZ4Compressed, ColorConsumer.toAWTColorArray(colors));
Expand All @@ -417,7 +392,7 @@ public static int[] decompressColorsToIntArray(StereoVisionPointCloudMessage mes
return decompressColorsToIntArray(message.getColors(), message.getNumberOfPoints(), message.getLz4Compressed());
}

public static int[] decompressColorsToIntArray(TByteArrayList compressedColors, int numberOfPoints, boolean isLZ4Compressed)
public static int[] decompressColorsToIntArray(IDLSequence.Byte compressedColors, int numberOfPoints, boolean isLZ4Compressed)
{
int[] colors = new int[numberOfPoints];
decompressColors(compressedColors, numberOfPoints, isLZ4Compressed, ColorConsumer.toRGBArray(colors));
Expand All @@ -429,11 +404,11 @@ public static void decompressColors(StereoVisionPointCloudMessage message, Color
decompressColors(message.getColors(), message.getNumberOfPoints(), message.getLz4Compressed(), colorConsumer);
}

public static void decompressColors(TByteArrayList compressedColors, int numberOfPoints, boolean isLZ4Compressed, ColorConsumer colorConsumer)
public static void decompressColors(IDLSequence.Byte compressedColors, int numberOfPoints, boolean isLZ4Compressed, ColorConsumer colorConsumer)
{
if (isLZ4Compressed)
{
ByteBuffer compressedColorByteBuffer = ByteBuffer.wrap(compressedColors.toArray());
ByteBuffer compressedColorByteBuffer = compressedColors.copyByteBuffer();
int colorByteBufferSize = computeColorByteBufferSize(numberOfPoints);
ByteBuffer decompressedColorByteBuffer = ByteBuffer.allocate(colorByteBufferSize);
compressorThreadLocal.get().decompress(compressedColorByteBuffer, decompressedColorByteBuffer, colorByteBufferSize);
Expand Down Expand Up @@ -729,9 +704,9 @@ public void accept(double x, double y, double z)
public static interface ColorConsumer
{
/**
* @param r the red component in the range (0 - 255).
* @param g the green component in the range (0 - 255).
* @param b the blue component in the range (0 - 255).
* @param red the red component in the range (0 - 255).
* @param green the green component in the range (0 - 255).
* @param blue the blue component in the range (0 - 255).
*/
void accept(int red, int blue, int green);

Expand Down
4 changes: 2 additions & 2 deletions ihmc-high-level-behaviors/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ testDependencies {
api("us.ihmc:ihmc-graphics-libgdx-test:source")
api("us.ihmc:ihmc-path-planning-test:source")
api("org.cartesiantheatrics:bag-reader-java:0.0.1")
api("us.ihmc:scs2-examples:17-0.26.0")
api("us.ihmc:scs2-bullet-simulation-test:17-0.26.0")
api("us.ihmc:scs2-examples:17-0.27.0")
api("us.ihmc:scs2-bullet-simulation-test:17-0.27.0")
api("us.ihmc:example-simulations:source")
}

Expand Down
Loading
Loading