Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
Mecanum Drive
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Robotlab
Mecanum Drive
Commits
86baf6b7
Verified
Commit
86baf6b7
authored
3 years ago
by
Anton Tetov Johansson
Browse files
Options
Downloads
Patches
Plain Diff
adapted to ilon_car_ctrl
parent
7f797134
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
nodes/mecanum_drive_controller
+10
-6
10 additions, 6 deletions
nodes/mecanum_drive_controller
package.xml
+2
-0
2 additions, 0 deletions
package.xml
with
13 additions
and
6 deletions
.gitignore
+
1
−
0
View file @
86baf6b7
*.pyc
.vscode/
This diff is collapsed.
Click to expand it.
nodes/mecanum_drive_controller
+
10
−
6
View file @
86baf6b7
...
...
@@ -3,22 +3,23 @@ from __future__ import division
import
rospy
from
geometry_msgs.msg
import
Twist
from
std_msgs.msg
import
Int16MultiArray
from
ilon_wheel_ctrl.msg
import
WheelRates
from
mecanum_drive
import
controller
class
ControllerNode
:
ZERO_RATES
=
WheelRates
(
frontLeft
=
0
,
frontRight
=
0
,
backLeft
=
0
,
backRight
=
0
)
def
__init__
(
self
):
self
.
controller
=
controller
.
Controller
()
self
.
linearXVelocity
=
0.0
self
.
linearYVelocity
=
0.0
self
.
angularVelocity
=
0.0
self
.
wheels_to_send
=
Int16MultiArray
()
self
.
wheels_to_send
=
WheelRates
()
def
main
(
self
):
self
.
wheelPub
=
rospy
.
Publisher
(
'
wheels_desired_rate
'
,
Int16MultiArray
,
queue_size
=
1
)
WheelRates
,
queue_size
=
1
)
rospy
.
init_node
(
'
mecanum_drive_controller
'
)
self
.
nodeName
=
rospy
.
get_name
()
...
...
@@ -49,11 +50,14 @@ class ControllerNode:
speeds
=
self
.
controller
.
getSpeeds
(
self
.
linearXVelocity
,
self
.
linearYVelocity
,
self
.
angularVelocity
)
self
.
wheels_to_send
.
data
=
[
int
(
speeds
.
frontLeft
),
int
(
speeds
.
frontRight
),
int
(
speeds
.
rearLeft
),
int
(
speeds
.
rearRight
)]
self
.
wheels_to_send
.
frontLeft
=
int
(
speeds
.
frontLeft
)
self
.
wheels_to_send
.
frontRight
=
int
(
speeds
.
frontRight
)
self
.
wheels_to_send
.
backLeft
=
int
(
speeds
.
rearLeft
)
self
.
wheels_to_send
.
backRight
=
int
(
speeds
.
rearRight
)
self
.
wheelPub
.
publish
(
self
.
wheels_to_send
)
else
:
self
.
wheels_to_send
.
data
=
[
0
,
0
,
0
,
0
]
self
.
wheelPub
.
publish
(
self
.
wheels_to_send
)
self
.
wheelPub
.
publish
(
self
.
ZERO_RATES
)
def
twistCallback
(
self
,
twist
):
self
.
linearXVelocity
=
twist
.
linear
.
x
...
...
This diff is collapsed.
Click to expand it.
package.xml
+
2
−
0
View file @
86baf6b7
...
...
@@ -17,6 +17,8 @@
<depend>
geometry_msgs
</depend>
<depend>
actionlib_msgs
</depend>
<build_depend>
rostest
</build_depend>
<build_depend>
ilon_wheel_cmd
</build_depend>
<depend>
message_generation
</depend>
<exec_depend>
ilon_wheel_cmd
</exec_depend>
</package>
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