diff --git a/cmake/GetAimRT.cmake b/cmake/GetAimRT.cmake index e0070bd..28adaee 100644 --- a/cmake/GetAimRT.cmake +++ b/cmake/GetAimRT.cmake @@ -6,7 +6,7 @@ include(FetchContent) message(STATUS "get aimrt ...") set(aimrt_DOWNLOAD_URL - "https://github.com/AimRT/AimRT/archive/refs/tags/v0.10.0.tar.gz" + "https://github.com/AimRT/AimRT/archive/refs/tags/v1.2.0.tar.gz" CACHE STRING "") if(aimrt_LOCAL_SOURCE) diff --git a/src/module/mujoco_sim_module/common/xmodel_reader.cc b/src/module/mujoco_sim_module/common/xmodel_reader.cc index 5dab297..fc81d3a 100644 --- a/src/module/mujoco_sim_module/common/xmodel_reader.cc +++ b/src/module/mujoco_sim_module/common/xmodel_reader.cc @@ -20,16 +20,28 @@ std::optional GetJointSensorIdByJointName(const mjModel* m, std::string return std::nullopt; } -std::optional GetJointvelIdByJointName(const mjModel* m, std::string_view joint_name) { - return GetJointSensorIdByJointName(m, joint_name, mjSENS_JOINTVEL); +std::optional GetJointposIdByJointName(const mjModel* m, std::string_view joint_name) { + auto sensor_id = GetJointSensorIdByJointName(m, joint_name, mjSENS_JOINTPOS); + if (!sensor_id.has_value()) { + return std::nullopt; + } + return m->sensor_adr[sensor_id.value()]; } -std::optional GetJointposIdByJointName(const mjModel* m, std::string_view joint_name) { - return GetJointSensorIdByJointName(m, joint_name, mjSENS_JOINTPOS); +std::optional GetJointvelIdByJointName(const mjModel* m, std::string_view joint_name) { + auto sensor_id = GetJointSensorIdByJointName(m, joint_name, mjSENS_JOINTVEL); + if (!sensor_id.has_value()) { + return std::nullopt; + } + return m->sensor_adr[sensor_id.value()]; } std::optional GetJointactfrcIdByJointName(const mjModel* m, std::string_view joint_name) { - return GetJointSensorIdByJointName(m, joint_name, mjSENS_JOINTACTFRC); + auto sensor_id = GetJointSensorIdByJointName(m, joint_name, mjSENS_JOINTACTFRC); + if (!sensor_id.has_value()) { + return std::nullopt; + } + return m->sensor_adr[sensor_id.value()]; } std::optional GetJointSensorNameByJointName(const mjModel* m, std::string_view joint_name, mjtSensor sensor_type) { diff --git a/src/module/mujoco_sim_module/subscriber/joint_actuator_subscriber.cc b/src/module/mujoco_sim_module/subscriber/joint_actuator_subscriber.cc index 1bb96f3..a3f8ca7 100644 --- a/src/module/mujoco_sim_module/subscriber/joint_actuator_subscriber.cc +++ b/src/module/mujoco_sim_module/subscriber/joint_actuator_subscriber.cc @@ -113,8 +113,8 @@ void JointActuatorSubscriber::EventHandle(const std::shared_ptr