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

Ported DuckieDrone UKF 2D and 7D #133

Open
wants to merge 2 commits into
base: ente
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
from duckietown.dtros import DTParam, DTROS, NodeType, ParamType
from duckietown_msgs.msg import Segment, SegmentList
from geometry_msgs.msg import Point as PointMsg
from geometry_msgs.msg import TwistStamped

from nav_msgs.msg import Odometry
from sensor_msgs.msg import CompressedImage, Range
from opencv_apps.msg import FlowArrayStamped, Flow

Expand Down Expand Up @@ -59,7 +59,7 @@ def __init__(self, node_name):
self.pub_debug_image = rospy.Publisher(
"~debug/image/compressed", CompressedImage, queue_size=1
)
self.pub_odometry = rospy.Publisher("~visual_odometry", Odometry, queue_size=1)
self.pub_odometry = rospy.Publisher("~visual_odometry", TwistStamped, queue_size=1)
self.pub_motion_vectors = rospy.Publisher(
"~lineseglist_out", SegmentList, queue_size=1
)
Expand Down Expand Up @@ -161,15 +161,14 @@ def cb_projected_motion_vectors(self, msg: SegmentList):
self.logdebug(f"Computed velocity vector [m/s]: {velocity}")

# Publish the optical flow vector as odometry
odometry_msg = Odometry()
odometry_msg.header.stamp = now
velocity_msg = TwistStamped()
velocity_msg.header.stamp = now

# TODO: change this to the correct frame
odometry_msg.child_frame_id = "base_link"
odometry_msg.twist.twist.linear.x = velocity[0]
odometry_msg.twist.twist.linear.y = velocity[1]
velocity_msg.twist.linear.x = velocity[0]
velocity_msg.twist.linear.y = velocity[1]

self.pub_odometry.publish(odometry_msg)
self.pub_odometry.publish(velocity_msg)

# self.last_stamp = now

Expand Down
Loading