Pose and orientation of my robot is incorrect in Gazebo and RViz

asked 2017-01-04 23:45:47 -0600

This post is a wiki.
Anyone with karma >75 is welcome to improve it.

Pose and orientation of my robot is incorrect in Gazebo and RViz .

I have exported the URDF from Solidworks using solidworks to URDF plugin. I didn't modify any option in dialogues opened during export. Then i created an URDF package in ROS workspace and spawned the robot model into the world which resulted in inverted pose of the robot as shown in picture.