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

Restore world_source.world #106

Merged
merged 2 commits into from
Nov 5, 2014
Merged
Show file tree
Hide file tree
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
39 changes: 12 additions & 27 deletions hrpsys_gazebo_tutorials/euslisp/hrpsys-gazebo-utils.l
Original file line number Diff line number Diff line change
Expand Up @@ -94,38 +94,23 @@
(generate-room-models (format nil "room~a" name)))
(return-from generate-room-models))
;; check the model is derived from the room class
(let* ((robot-list (list "SampleRobot" "HRP2JSK" "HRP2JSKNT" "HRP2JSKNTS"))
(world-file-path-list)
(room (funcall (read-from-string name))))
(let* ((world-file-path-list)
(room (funcall (read-from-string name))))
(unless (derivedp room scene)
(warn "[ERROR] room (~a) is not room the model.~%" name)
(return-from generate-room-models))

;; generate the world file
(dolist (robot-name robot-list)
(let* ((room-name (string-downcase (send room :name)))
(package-dir-path (string-downcase (read (piped-fork "rospack find hrpsys_gazebo_tutorials"))))
(world-src-file-path (format nil "~a/worlds/world_source.world" package-dir-path))
(world-new-file-path (format nil "~a/worlds/~a_~a.world" package-dir-path robot-name room-name)))
(unix:system (format nil "rm -rf ~a" world-new-file-path))
(unix:system (format nil "cp ~a ~a" world-src-file-path world-new-file-path))
(unix:system (format nil "sed -i -e \"s@ <!-- A robot -->@ <!-- A robot -->\\n <include>\\n <uri>model://~a</uri>\\n <pose>1.0 0 0.73 0 0 0</pose>\\n </include>@g\" ~a" robot-name world-new-file-path))
(push world-new-file-path world-file-path-list)))

(let* ((room-name (string-downcase (send room :name)))
(package-dir-path (string-downcase (read (piped-fork "rospack find hrpsys_gazebo_tutorials"))))
(world-src-file-path (format nil "~a/worlds/world_source.world" package-dir-path))
(world-new-file-path (format nil "~a/worlds/~a.world" package-dir-path room-name)))
(unix:system (format nil "rm -rf ~a" world-new-file-path))
(unix:system (format nil "cp ~a ~a" world-src-file-path world-new-file-path))
(push world-new-file-path world-file-path-list))
;; convert models
(eus2urdf-room-for-gazebo room
:make-static t :make-fixed t :world-file-path-list world-file-path-list)
;; generate the launch file
(dolist (robot-name robot-list)
(let* ((room-name (string-downcase (send room :name)))
(package-dir-path (string-downcase (read (piped-fork "rospack find hrpsys_gazebo_tutorials"))))
(launch-src-file-path (format nil "~a/launch/gazebo_launch_source.launch" package-dir-path))
(launch-new-file-path (format nil "~a/launch/gazebo_~a_no_controllers_in_~a.launch" package-dir-path (string-downcase robot-name) room-name)))
(unix:system (format nil "rm -rf ~a" launch-new-file-path))
(unix:system (format nil "cp ~a ~a" launch-src-file-path launch-new-file-path))
(unix:system (format nil "sed -i -e \"s@__world_name__@~a_~a.world@g\" ~a" robot-name room-name launch-new-file-path))
(unix:system (format nil "sed -i -e \"s@__robot_name__@~a@g\" ~a" (string-downcase robot-name) launch-new-file-path))
(warning-message 2 "You can start simulation with following command:~%roslaunch hrpsys_gazebo_tutorials gazebo_~a_no_controllers_in_~a.launch~%" (string-downcase robot-name) room-name))))
)
(eus2urdf-room-for-gazebo room
:make-static t :make-fixed t :world-file-path-list world-file-path-list)
))
(warn "(generate-room-models \"room73b2\")~%")

35 changes: 35 additions & 0 deletions hrpsys_gazebo_tutorials/worlds/world_source.world
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" ?>
<!-- This is a source file of world. -->
<!-- Do not edit this file. -->
<sdf version="1.4">
<world name="default">
<physics type="ode">
<gravity>0 0 -9.81</gravity>
<ode>
<solver>
<type>quick</type>
<iters>50</iters>
<sor>1.4</sor>
</solver>
<constraints>
<cfm>0.0</cfm>
<erp>0.2</erp>
<contact_max_correcting_vel>100.0</contact_max_correcting_vel>
<contact_surface_layer>0.0</contact_surface_layer>
</constraints>
</ode>
<real_time_update_rate>1000</real_time_update_rate>
<max_step_size>0.001</max_step_size>
</physics>
<!-- A global light source -->
<include>
<uri>model://sun</uri>
</include>
<!-- A ground plane -->
<include>
<uri>model://ground_plane</uri>
</include>
<!-- A robot -->
<!-- Objects -->
</world>
</sdf>