Skip to content

Commit

Permalink
137/chrono build fix (#139)
Browse files Browse the repository at this point in the history
* Updated utils.py to latest chrono versions

* Fixed docker

* Updated demo
  • Loading branch information
AaronYoung5 authored Jan 27, 2024
1 parent c74abcd commit 2749329
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
15 changes: 6 additions & 9 deletions docker/snippets/chrono.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ RUN wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | tee /etc/
apt-get update && apt-get install vulkan-sdk -y && \
apt-get clean && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*

# Temporarily change to the user so that file permissions are okay
USER ${USERNAME}

# chrono_ros_interfaces
ARG ROS_WORKSPACE_DIR="${USERHOME}/ros_workspace"
ARG CHRONO_ROS_INTERFACES_DIR="${ROS_WORKSPACE_DIR}/src/chrono_ros_interfaces"
Expand All @@ -57,9 +54,9 @@ ARG CHRONO_INSTALL_DIR="/opt/chrono"
RUN git clone --recursive -b ${CHRONO_BRANCH} ${CHRONO_REPO} ${CHRONO_DIR} && \
. ${ROS_WORKSPACE_DIR}/install/setup.sh && \
cd ${CHRONO_DIR}/contrib/build-scripts/vsg/ && \
sudo bash buildVSG.sh /opt/vsg && \
bash buildVSG.sh /opt/vsg && \
cd ${CHRONO_DIR}/contrib/build-scripts/urdf/ && \
sudo bash buildURDF.sh /opt/urdf && \
bash buildURDF.sh /opt/urdf && \
mkdir ${CHRONO_DIR}/build && \
cd ${CHRONO_DIR}/build && \
cmake ../ -G Ninja \
Expand Down Expand Up @@ -88,12 +85,12 @@ RUN git clone --recursive -b ${CHRONO_BRANCH} ${CHRONO_REPO} ${CHRONO_DIR} && \
-Dconsole_bridge_DIR=/opt/urdf/lib/console_bridge/cmake \
-Dtinyxml2_DIR=/opt/urdf/CMake \
&& \
ninja && sudo sh -c ". ${ROS_WORKSPACE_DIR}/install/setup.sh; ninja install"
ninja && ninja install

# Switch back out of the USER back to root
USER root
# chown the chrono dir so that we can edit it
RUN chown -R ${USERNAME}:${USERNAME} ${CHRONO_DIR} ${ROS_WORKSPACE_DIR}

# Update shell config
RUN echo ". ${ROS_WORKSPACE_DIR}/install/setup.sh" >> ${USERSHELLPROFILE} && \
echo "export PYTHONPATH=\$PYTHONPATH:${CHRONO_INSTALL_DIR}/share/chrono/python" >> ${USERSHELLPROFILE} && \
echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:${CHRONO_INSTALL_DIR}/lib" >> ${USERSHELLPROFILE}
echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:${CHRONO_INSTALL_DIR}/lib:/opt/urdf/lib" >> ${USERSHELLPROFILE}
5 changes: 3 additions & 2 deletions sim/cpp/demo_ROS_sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ int main(int argc, char* argv[]) {
false, true);
mmesh->Transform(ChVector<>(0, 0, 0), ChMatrix33<>(1));

auto trimesh_shape = chrono_types::make_shared<ChTriangleMeshShape>();
auto trimesh_shape = chrono_types::make_shared<ChVisualShapeTriangleMesh>();
trimesh_shape->SetMesh(mmesh);
trimesh_shape->SetName("Audi Chassis Mesh");
trimesh_shape->SetMutable(false);
Expand Down Expand Up @@ -168,7 +168,8 @@ int main(int argc, char* argv[]) {
// Create the publisher for the lidar
auto lidar_2d_topic_name = "~/output/lidar_2d/data/laser_scan";
auto lidar_2d_handler = chrono_types::make_shared<ChROSLidarHandler>(
lidar_2d, lidar_2d_topic_name, false); // last parameter indicates whether to use LaserScan or PointCloud2
lidar_2d, lidar_2d_topic_name,
ChROSLidarHandlerMessageType::LASER_SCAN); // last parameter indicates whether to use LaserScan or PointCloud2
ros_manager->RegisterHandler(lidar_2d_handler);

// Create the publisher for the accelerometer
Expand Down
4 changes: 2 additions & 2 deletions sim/python/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def AddConesFromFile(
pos = chrono.ChVectorD(pos_x, pos_y, pos_z)
rot = chrono.ChQuaternionD(1, 0, 0, 0)

cone_shape = chrono.ChTriangleMeshShape()
cone_shape = chrono.ChVisualShapeTriangleMesh()
if color == 0:
cone_shape.SetMesh(red_cone_mesh)
red_cone_assets.append(cone_shape)
Expand All @@ -50,7 +50,7 @@ def AddConesFromFile(
return red_cone_assets, green_cone_assets


def LabelAssets(assets: List[chrono.ChTriangleMeshShape], class_id: int):
def LabelAssets(assets: List[chrono.ChVisualShapeTriangleMesh], class_id: int):
instance_id = 0
for cone in assets:
instance_id += 1
Expand Down

0 comments on commit 2749329

Please sign in to comment.