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

Enable to output transmission_interface instead of pr2_mechanism_model #35

Merged
merged 1 commit into from
Jun 12, 2020
Merged
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
35 changes: 27 additions & 8 deletions collada_urdf/src/collada_to_urdf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ using namespace std;
bool use_simple_visual = false;
bool use_simple_collision = false;
bool add_gazebo_description = false;
bool use_transmission_interface = false;
bool use_assimp_export = false;
bool use_same_collision_as_visual = true;
bool rotate_inertia_frame = true;
Expand Down Expand Up @@ -480,14 +481,27 @@ void addChildJointNamesXML(urdf::LinkConstSharedPtr link, ofstream& os)
os << " </joint>" << endl;

if ( add_gazebo_description ) {
os << " <transmission type=\"pr2_mechanism_model/SimpleTransmission\" name=\"";
os << (*child)->parent_joint->name << "_trans\" >" << endl;
os << " <actuator name=\"" << (*child)->parent_joint->name << "_motor\" />" << endl;
os << " <joint name=\"" << (*child)->parent_joint->name << "\" />" << endl;
os << " <mechanicalReduction>1</mechanicalReduction>" << endl;
//os << " <motorTorqueConstant>1</motorTorqueConstant>" << endl;
//os << " <pulsesPerRevolution>90000</pulsesPerRevolution>" << endl;
os << " </transmission>" << endl;
if ( !use_transmission_interface ) {
os << " <transmission type=\"pr2_mechanism_model/SimpleTransmission\" name=\"";
os << (*child)->parent_joint->name << "_trans\" >" << endl;
os << " <actuator name=\"" << (*child)->parent_joint->name << "_motor\" />" << endl;
os << " <joint name=\"" << (*child)->parent_joint->name << "\" />" << endl;
os << " <mechanicalReduction>1</mechanicalReduction>" << endl;
//os << " <motorTorqueConstant>1</motorTorqueConstant>" << endl;
//os << " <pulsesPerRevolution>90000</pulsesPerRevolution>" << endl;
os << " </transmission>" << endl;
} else {
os << " <transmission name=\"" << (*child)->parent_joint->name << "_trans\">" << endl;
os << " <type>transmission_interface/SimpleTransmission</type>" << endl;
os << " <joint name=\"" << (*child)->parent_joint->name << "\">" << endl;
os << " <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>" << endl;
os << " </joint>" << endl;
os << " <actuator name=\"" << (*child)->parent_joint->name << "_motor\">" << endl;
os << " <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>" << endl;
os << " <mechanicalReduction>1</mechanicalReduction>" << endl;
os << " </actuator>" << endl;
os << " </transmission>" << endl;
}
#ifdef GAZEBO_1_3
os << " <gazebo reference=\"" << (*child)->parent_joint->name << "\">" << endl;
os << " <cfmDamping>0.4</cfmDamping>" << endl;
Expand Down Expand Up @@ -528,6 +542,7 @@ int main(int argc, char** argv)
("simple_collision,C", "use bounding box for collision")
("export_collision_mesh", "export collision mesh as STL")
("add_gazebo_description,G", "add description for using on gazebo")
("use_transmission_interface,T", "use transmission_interface as transmission")
("use_assimp_export,A", "use assimp library for exporting mesh")
("use_collision,U", "use collision geometry (default collision is the same as visual)")
("original_inertia_rotation,R", "does not rotate inertia frame")
Expand Down Expand Up @@ -568,6 +583,10 @@ int main(int argc, char** argv)
add_gazebo_description = true;
cerr << ";; Adding gazebo description" << endl;
}
if (vm.count("use_transmission_interface")) {
use_transmission_interface = true;
cerr << ";; Using transmission_interface as transmission" << endl;
}
if (vm.count("use_assimp_export")) {
#if defined(ASSIMP_EXPORT_API)
use_assimp_export = true;
Expand Down