morse-simulator / morse

The Modular OpenRobots Simulation Engine
http://morse-simulator.github.io/
Other
351 stars 155 forks source link

Rotorcraft velocity appears to publish wrong yaw value #751

Open miscott opened 7 years ago

miscott commented 7 years ago

I am using MORSE 1.4-29-g83746 with ROS indigo to simulate a Quadrotor. I have been using the RotorcraftVelocity controller to give yaw and velocity commands to the robot. For my project, I need to know the direction that the robot is travelling in, as well as the speed. I decided to use the velocity sensor, which should work fine. The problem: when I publish a yaw rate via ros topic the resulting yaw rate is incorrect. For example, if I publish a yaw rate of pi directly to the RotorcraftVelocity, the velocity sensor reads -2.05. Obviously, this is a bit of a problem as I no longer am aware of the direction the robot is travailing in. I was wondering if this is most likely an error with the controller, or with the sensor (IMU perhaps?).

My basic builder script:

from morse.builder import *
from morse.middleware import *
from math import pi
import random
from params import *

robot_number = robot_number_inital

##Robot##
robot = Quadrotor()
robot.translate(x=0, y=0, z=8.0)

##Motion##
#motion = StabilizedQuadrotor()
motion = RotorcraftVelocity()
#motion.translate(z=0.3)
T = '/robot/motion1'
motion.add_interface('ros',topic=T) 
robot.append(motion)

keyboard= Keyboard()
robot.append(keyboard)
##Pose##
pose = Pose()
#pose.translate(z=0.83)
T = '/robot/pose1'
pose.add_interface('ros', topic=T)
robot.append(pose)

velocity = Velocity()
robot.append(velocity)
T = 'velocity1'
velocity.add_interface('ros', topic = T)

odom = Odometry()
robot.append(odom)
odom.add_interface('ros', topic ='/odom')

#env = Environment('empty')
#env = Environment('land-1/trees')
#env = Environment('land-1/buildings_2')
env = Environment('water-1/water_scene')

#env = Environment('outdoors')
env.set_camera_location([10.0, -10.0, 10.0])
env.set_camera_rotation([1.0470, 0, 0.7854])

Thanks in advance!