Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Robobin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
plw1g21
Robobin
Commits
0453d1df
Commit
0453d1df
authored
6 months ago
by
Paul-Winpenny
Browse files
Options
Downloads
Patches
Plain Diff
IMU needs to be powered on and then the offset should be looked at. NEeds to be tested in the lab
parent
b3c7cae5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ros2/src/robobin/robobin/helpers/message_handler.py
+8
-8
8 additions, 8 deletions
ros2/src/robobin/robobin/helpers/message_handler.py
ros2/src/robobin/robobin/uwb_pathing_node.py
+1
-1
1 addition, 1 deletion
ros2/src/robobin/robobin/uwb_pathing_node.py
with
9 additions
and
9 deletions
ros2/src/robobin/robobin/helpers/message_handler.py
+
8
−
8
View file @
0453d1df
...
@@ -114,10 +114,10 @@ class MessageHandler:
...
@@ -114,10 +114,10 @@ class MessageHandler:
# D: linear.x = 0, angular.z = -0.5
# D: linear.x = 0, angular.z = -0.5
directions
=
{
directions
=
{
"
W
"
:
(
0.5
,
0
),
# Move forward
"
W
"
:
(
0.
2
5
,
0
),
# Move forward
"
A
"
:
(
0
,
0.5
),
# Turn left
"
A
"
:
(
0
,
0.
2
5
),
# Turn left
"
S
"
:
(
-
0.5
,
0
),
# Move backward
"
S
"
:
(
-
0.
2
5
,
0
),
# Move backward
"
D
"
:
(
0
,
-
0.5
)
# Turn right
"
D
"
:
(
0
,
-
0.
2
5
)
# Turn right
}
}
# Get direction data and ensure it's a tuple of floats
# Get direction data and ensure it's a tuple of floats
...
@@ -195,10 +195,10 @@ if __name__ == "__main__":
...
@@ -195,10 +195,10 @@ if __name__ == "__main__":
message_handler
=
MessageHandler
(
None
,
testing
=
True
)
message_handler
=
MessageHandler
(
None
,
testing
=
True
)
assert
message_handler
.
handle_message
(
None
,
"
PING
"
)
is
None
assert
message_handler
.
handle_message
(
None
,
"
PING
"
)
is
None
assert
message_handler
.
handle_message
(
None
,
"
TIME
"
)
is
None
assert
message_handler
.
handle_message
(
None
,
"
TIME
"
)
is
None
assert
message_handler
.
handle_message
(
None
,
"
MANUALCTRL W
"
)
==
(
"
cmd_vel
"
,
(
0.5
,
0
))
assert
message_handler
.
handle_message
(
None
,
"
MANUALCTRL W
"
)
==
(
"
cmd_vel
"
,
(
0.
2
5
,
0
))
assert
message_handler
.
handle_message
(
None
,
"
MANUALCTRL A
"
)
==
(
"
cmd_vel
"
,
(
0
,
0.5
))
assert
message_handler
.
handle_message
(
None
,
"
MANUALCTRL A
"
)
==
(
"
cmd_vel
"
,
(
0
,
0.
2
5
))
assert
message_handler
.
handle_message
(
None
,
"
MANUALCTRL S
"
)
==
(
"
cmd_vel
"
,
(
-
0.5
,
0
))
assert
message_handler
.
handle_message
(
None
,
"
MANUALCTRL S
"
)
==
(
"
cmd_vel
"
,
(
-
0.
2
5
,
0
))
assert
message_handler
.
handle_message
(
None
,
"
MANUALCTRL D
"
)
==
(
"
cmd_vel
"
,
(
0
,
-
0.5
))
assert
message_handler
.
handle_message
(
None
,
"
MANUALCTRL D
"
)
==
(
"
cmd_vel
"
,
(
0
,
-
0.
2
5
))
assert
message_handler
.
handle_message
(
None
,
"
STOP
"
)
==
(
"
cmd_vel
"
,
(
0.0
,
0.0
))
assert
message_handler
.
handle_message
(
None
,
"
STOP
"
)
==
(
"
cmd_vel
"
,
(
0.0
,
0.0
))
assert
message_handler
.
handle_message
(
None
,
"
CALLME (212.9638, 283.98108)
"
)
==
(
"
nav_command
"
,
"
(212.9638, 283.98108)
"
)
assert
message_handler
.
handle_message
(
None
,
"
CALLME (212.9638, 283.98108)
"
)
==
(
"
nav_command
"
,
"
(212.9638, 283.98108)
"
)
...
...
This diff is collapsed.
Click to expand it.
ros2/src/robobin/robobin/uwb_pathing_node.py
+
1
−
1
View file @
0453d1df
...
@@ -73,7 +73,7 @@ class UWBPathingNode(Node):
...
@@ -73,7 +73,7 @@ class UWBPathingNode(Node):
return
return
# Calculate yaw error (assuming robot orientation 0 = facing x-axis)
# Calculate yaw error (assuming robot orientation 0 = facing x-axis)
# If you don't have actual orientation, you might assume the robot always faces the target directly
yaw_error
=
angle_to_target
yaw_error
=
angle_to_target
yaw_error
=
atan2
(
sin
(
yaw_error
),
cos
(
yaw_error
))
# Normalize angle
yaw_error
=
atan2
(
sin
(
yaw_error
),
cos
(
yaw_error
))
# Normalize angle
self
.
get_logger
().
info
(
f
"
Current Position: x=
{
self
.
current_x
:
.
2
f
}
, y=
{
self
.
current_y
:
.
2
f
}
"
)
self
.
get_logger
().
info
(
f
"
Current Position: x=
{
self
.
current_x
:
.
2
f
}
, y=
{
self
.
current_y
:
.
2
f
}
"
)
...
...
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