Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
PTCE Double Integrator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
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
Silas Baumann
PTCE Double Integrator
Commits
eedb2351
Commit
eedb2351
authored
3 months ago
by
Lukas Krauß
Browse files
Options
Downloads
Patches
Plain Diff
Added reference position generator
parent
baf9d1d9
No related branches found
Branches containing commit
No related tags found
2 merge requests
!3
Version 0.0.1
,
!1
Adding the position generator, controller and double integrator
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
my_double_integrator/reference_position_generator.py
+35
-0
35 additions, 0 deletions
my_double_integrator/reference_position_generator.py
with
35 additions
and
0 deletions
my_double_integrator/reference_position_generator.py
0 → 100644
+
35
−
0
View file @
eedb2351
import
rclpy
from
rclpy.node
import
Node
from
std_msgs.msg
import
Float64
class
ReferencePositionGen
(
Node
):
def
__init__
(
self
):
super
().
__init__
(
'
reference_position_gen
'
)
self
.
declare_parameter
(
'
rate
'
,
1.0
)
self
.
declare_parameter
(
'
amplitude
'
,
1.0
)
self
.
rate
=
self
.
get_parameter
(
'
rate
'
).
value
self
.
amplitude
=
self
.
get_parameter
(
'
amplitude
'
).
value
self
.
reference_pub
=
self
.
create_publisher
(
Float64
,
'
desired_position
'
,
10
)
self
.
timer
=
self
.
create_timer
(
1.0
/
self
.
rate
,
self
.
publish_reference
)
self
.
time
=
0.0
def
publish_reference
(
self
):
msg
=
Float64
()
msg
.
data
=
self
.
amplitude
*
self
.
time
# Linearly increasing reference
self
.
reference_pub
.
publish
(
msg
)
self
.
time
+=
1.0
/
self
.
rate
def
main
(
args
=
None
):
rclpy
.
init
(
args
=
args
)
node
=
ReferencePositionGen
()
rclpy
.
spin
(
node
)
node
.
destroy_node
()
rclpy
.
shutdown
()
if
__name__
==
'
__main__
'
:
main
()
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