Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Simox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Florian Leander Singer
Simox
Commits
533d7ca1
Commit
533d7ca1
authored
5 years ago
by
Rainer Kartmann
Browse files
Options
Downloads
Patches
Plain Diff
Update Simox2Mjcf
parent
d6f9b789
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
VirtualRobot/examples/Simox2Mjcf/main.cpp
+14
-20
14 additions, 20 deletions
VirtualRobot/examples/Simox2Mjcf/main.cpp
with
14 additions
and
20 deletions
VirtualRobot/examples/Simox2Mjcf/main.cpp
+
14
−
20
View file @
533d7ca1
...
...
@@ -3,7 +3,7 @@
#include
<VirtualRobot/RuntimeEnvironment.h>
#include
<VirtualRobot/XML/RobotIO.h>
#include
<VirtualRobot/XML/mujoco/
MujocoIO
.h>
#include
<VirtualRobot/XML/mujoco/
RobotMjcf
.h>
using
namespace
VirtualRobot
;
...
...
@@ -30,8 +30,6 @@ int main(int argc, char* argv[])
RuntimeEnvironment
::
considerKey
(
"actuator"
,
"The actuator type to add (motor, position, velocity). (default: motor)"
);
RuntimeEnvironment
::
considerKey
(
"sanitize_bodies"
,
"How to sanitize massless bodies (none, dummymass, merge). (default: none)"
);
RuntimeEnvironment
::
considerFlag
(
"mount"
,
"How to mount the robot at the world body (fixed, free, mocap). (default: fixed)"
);
...
...
@@ -46,8 +44,8 @@ int main(int argc, char* argv[])
RuntimeEnvironment
::
considerKey
(
"scale_mass"
,
"Scaling of masses (to kg). (default: 1.0)"
);
RuntimeEnvironment
::
considerFlag
(
"verbose"
,
"Enable verbose output."
);
//
RuntimeEnvironment::considerFlag(
//
"verbose", "Enable verbose output.");
RuntimeEnvironment
::
processCommandLine
(
argc
,
argv
);
...
...
@@ -79,15 +77,12 @@ int main(int argc, char* argv[])
const
std
::
string
actuatorTypeStr
=
RuntimeEnvironment
::
checkParameter
(
"actuator"
,
"motor"
);
mujoco
::
ActuatorType
actuatorType
;
const
std
::
string
bodySanitizeModeStr
=
RuntimeEnvironment
::
checkParameter
(
"sanitize_bodies"
,
"none"
);
mujoco
::
BodySanitizeMode
bodySanitizeMode
;
const
std
::
string
worldMountModeStr
=
RuntimeEnvironment
::
checkParameter
(
"mount"
,
"fixed"
);
mujoco
::
WorldMountMode
worldMountMode
;
try
{
actuatorType
=
mujoco
::
toActuatorType
(
actuatorTypeStr
);
bodySanitizeMode
=
mujoco
::
toBodySanitizeMode
(
bodySanitizeModeStr
);
worldMountMode
=
mujoco
::
toWorldMountMode
(
worldMountModeStr
);
}
catch
(
const
std
::
out_of_range
&
e
)
...
...
@@ -96,7 +91,7 @@ int main(int argc, char* argv[])
return
-
1
;
}
const
bool
verbose
=
RuntimeEnvironment
::
hasFlag
(
"verbose"
);
//
const bool verbose = RuntimeEnvironment::hasFlag("verbose");
const
bool
useRelativePaths
=
RuntimeEnvironment
::
hasFlag
(
"rel_paths"
);
...
...
@@ -135,7 +130,6 @@ int main(int argc, char* argv[])
std
::
cout
<<
"Output dir: "
<<
outputDir
<<
std
::
endl
;
std
::
cout
<<
"Output mesh dir: "
<<
outputDir
/
meshRelDir
<<
std
::
endl
;
std
::
cout
<<
"Actuator type: "
<<
actuatorTypeStr
<<
std
::
endl
;
std
::
cout
<<
"Body Sanitize Mode: "
<<
bodySanitizeModeStr
<<
std
::
endl
;
std
::
cout
<<
"World Mount Mode: "
<<
worldMountModeStr
<<
std
::
endl
;
std
::
cout
<<
"Scaling: "
<<
std
::
endl
...
...
@@ -165,20 +159,20 @@ int main(int argc, char* argv[])
else
{
// Direct API.
mujoco
::
MujocoIO
mujocoIO
(
robot
);
mujoco
::
RobotMjcf
mjcf
(
robot
);
mujocoIO
.
setActuatorType
(
actuatorType
);
mujocoIO
.
setBodySanitizeMode
(
bodySanitizeMode
);
mjcf
.
setUseRelativePaths
(
useRelativePaths
);
m
ujocoIO
.
setUseRelativePaths
(
useRelativePaths
);
m
ujocoIO
.
setWorldMountMode
(
worldMountMode
);
m
jcf
.
setOutputFile
(
outputDir
/
inputFilename
.
filename
()
);
m
jcf
.
setOutputMeshRelativeDirectory
(
meshRelDir
);
m
ujocoIO
.
setLengthScale
(
scaleLength
);
m
ujocoIO
.
setMeshScale
(
scaleMesh
);
m
ujocoIO
.
setMassScale
(
scaleMass
);
m
jcf
.
setLengthScale
(
scaleLength
);
m
jcf
.
setMeshScale
(
scaleMesh
);
m
jcf
.
setMassScale
(
scaleMass
);
mujocoIO
.
setVerbose
(
verbose
);
// mjcf
.setVerbose(verbose);
mujocoIO
.
saveMJCF
(
inputFilename
.
filename
(),
outputDir
,
meshRelDir
);
mjcf
.
build
(
worldMountMode
,
actuatorType
);
mjcf
.
save
();
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment