-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from tongtybj/develop/mujoco
[Mujoco] refactor files about mujoco
- Loading branch information
Showing
17 changed files
with
241 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
aerial_robot_simulation/include/aerial_robot_simulation/mujoco/mujoco_aerial_robot_hw_sim.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#pragma once | ||
|
||
|
||
#include <aerial_robot_simulation/mujoco/mujoco_default_robot_hw_sim.h> | ||
#include <aerial_robot_simulation/mujoco/mujoco_spinal_interface.h> | ||
#include <aerial_robot_simulation/noise_model.h> | ||
#include <geometry_msgs/PoseStamped.h> | ||
#include <nav_msgs/Odometry.h> | ||
|
||
namespace mujoco_ros_control | ||
{ | ||
class AerialRobotHWSim : public mujoco_ros_control::DefaultRobotHWSim | ||
{ | ||
public: | ||
AerialRobotHWSim() {}; | ||
~AerialRobotHWSim() {} | ||
|
||
bool init(const std::string& robot_namespace, | ||
ros::NodeHandle model_nh, | ||
mjModel* mujoco_model, | ||
mjData* mujoco_data | ||
) override; | ||
|
||
void read(const ros::Time& time, const ros::Duration& period) override; | ||
|
||
void write(const ros::Time& time, const ros::Duration& period) override; | ||
|
||
protected: | ||
hardware_interface::MujocoSpinalInterface spinal_interface_; | ||
|
||
std::vector<std::string> rotor_list_; | ||
ros::Publisher ground_truth_pub_; | ||
ros::Publisher mocap_pub_; | ||
double ground_truth_pub_rate_; | ||
double mocap_pub_rate_; | ||
double mocap_rot_noise_, mocap_pos_noise_; | ||
double ground_truth_pos_noise_, ground_truth_vel_noise_, ground_truth_rot_noise_, ground_truth_angular_noise_; | ||
double ground_truth_rot_drift_, ground_truth_vel_drift_, ground_truth_angular_drift_; | ||
double ground_truth_rot_drift_frequency_, ground_truth_vel_drift_frequency_, ground_truth_angular_drift_frequency_; | ||
double joint_state_pub_rate_ = 0.02; | ||
|
||
ros::Time last_mocap_time_; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
aerial_robot_simulation/include/aerial_robot_simulation/mujoco/mujoco_default_robot_hw_sim.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#pragma once | ||
|
||
#include <urdf/model.h> | ||
#include <pluginlib/class_list_macros.h> | ||
#include <aerial_robot_simulation/mujoco/mujoco_robot_hw_sim.h> | ||
#include <sensor_msgs/JointState.h> | ||
|
||
namespace mujoco_ros_control | ||
{ | ||
class DefaultRobotHWSim : public mujoco_ros_control::RobotHWSim | ||
{ | ||
public: | ||
DefaultRobotHWSim() {}; | ||
~DefaultRobotHWSim() {} | ||
|
||
bool virtual init(const std::string& robot_namespace, | ||
ros::NodeHandle model_nh, | ||
mjModel* mujoco_model, | ||
mjData* mujoco_data | ||
); | ||
|
||
void virtual read(const ros::Time& time, const ros::Duration& period); | ||
|
||
void virtual write(const ros::Time& time, const ros::Duration& period); | ||
|
||
void controlInputCallback(const sensor_msgs::JointState & msg); | ||
|
||
|
||
protected: | ||
mjModel* mujoco_model_; | ||
mjData* mujoco_data_; | ||
|
||
std::vector<std::string> joint_list_; | ||
ros::Publisher joint_state_pub_; | ||
ros::Subscriber control_input_sub_; | ||
double joint_state_pub_rate_ = 0.02; | ||
std::vector<double> control_input_; | ||
|
||
ros::Time last_joint_state_time_; | ||
|
||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
83 changes: 0 additions & 83 deletions
83
aerial_robot_simulation/include/aerial_robot_simulation/mujoco_robot_hw_sim.h
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
<library path="lib/libmujoco_robot_hw_sim"> | ||
<class | ||
name="mujoco_ros_control/MujocoRobotHWSim" | ||
type="mujoco_ros_control::MujocoRobotHWSim" | ||
base_class_type="mujoco_ros_control::MujocoRobotHWSimPlugin"> | ||
name="mujoco_ros_control/DefaultRobotHWSim" | ||
type="mujoco_ros_control::DefaultRobotHWSim" | ||
base_class_type="mujoco_ros_control::RobotHWSim"> | ||
<description> | ||
A aerial robot simulation interface in MuJoCo. | ||
Default simulation interface in MuJoCo. | ||
</description> | ||
</class> | ||
<class | ||
name="mujoco_ros_control/AerialRobotHWSim" | ||
type="mujoco_ros_control::AerialRobotHWSim" | ||
base_class_type="mujoco_ros_control::RobotHWSim"> | ||
<description> | ||
simulation interface for aerial robot in MuJoCo. | ||
</description> | ||
</class> | ||
</library> |
Oops, something went wrong.