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

Odometry should be published in robot coordinates #774

Merged
merged 1 commit into from
Dec 15, 2017
Merged
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
19 changes: 8 additions & 11 deletions src/morse/sensors/odometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def __init__(self, obj, parent=None):

def default_action(self):
# Compute the position of the sensor within the original frame
current_pos = self.original_pos.transformation3d_with(self.position_3d)
current_pos = copy.copy(self.position_3d)

# Integrated version
self._dx = current_pos.x - self.previous_pos.x
Expand All @@ -132,16 +132,13 @@ def default_action(self):
self.local_data['pitch'] = current_pos.pitch
self.local_data['roll'] = current_pos.roll

# speed in the sensor frame, related to the robot pose
lin_vel = linear_velocities(self.previous_pos, current_pos, 1/self.frequency)
ang_vel = angular_velocities(self.previous_pos, current_pos,1/self.frequency)

self.local_data['vx'] = lin_vel[0]
self.local_data['vy'] = lin_vel[1]
self.local_data['vz'] = lin_vel[2]
self.local_data['wx'] = ang_vel[0]
self.local_data['wy'] = ang_vel[1]
self.local_data['wz'] = ang_vel[2]
self.delta_pos = self.previous_pos.transformation3d_with(current_pos)
self.local_data['vx'] = self.delta_pos.x * self.frequency
self.local_data['vy'] = self.delta_pos.y * self.frequency
self.local_data['vz'] = self.delta_pos.z * self.frequency
self.local_data['wz'] = self.delta_pos.yaw * self.frequency
self.local_data['wy'] = self.delta_pos.pitch * self.frequency
self.local_data['wx'] = self.delta_pos.roll * self.frequency

# Store the 'new' previous data
self.previous_pos = current_pos
Expand Down