Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Semesterprojekt Modulbasiertes Testen
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Trappe
Semesterprojekt Modulbasiertes Testen
Commits
585e57b5
Commit
585e57b5
authored
5 years ago
by
Daniel Christoph
Browse files
Options
Downloads
Patches
Plain Diff
Update src/sim/plugins/model_push.cc
parent
6d5fb9a6
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sim/plugins/model_push.cc
+38
-0
38 additions, 0 deletions
src/sim/plugins/model_push.cc
with
38 additions
and
0 deletions
src/sim/plugins/model_push.cc
0 → 100644
+
38
−
0
View file @
585e57b5
#include
<functional>
#include
<gazebo/gazebo.hh>
#include
<gazebo/physics/physics.hh>
#include
<gazebo/common/common.hh>
#include
<ignition/math/Vector3.hh>
namespace
gazebo
{
class
ModelPush
:
public
ModelPlugin
{
public:
void
Load
(
physics
::
ModelPtr
_parent
,
sdf
::
ElementPtr
/*_sdf*/
)
{
// Store the pointer to the model
this
->
model
=
_parent
;
// Listen to the update event. This event is broadcast every
// simulation iteration.
this
->
updateConnection
=
event
::
Events
::
ConnectWorldUpdateBegin
(
std
::
bind
(
&
ModelPush
::
OnUpdate
,
this
));
}
// Called by the world update start event
public
:
void
OnUpdate
()
{
// Apply a small linear velocity to the model.
this
->
model
->
SetLinearVel
(
ignition
::
math
::
Vector3d
(
0.3
,
0
,
0
));
}
// Pointer to the model
private
:
physics
::
ModelPtr
model
;
// Pointer to the update event connection
private
:
event
::
ConnectionPtr
updateConnection
;
};
// Register this plugin with the simulator
GZ_REGISTER_MODEL_PLUGIN
(
ModelPush
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
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