ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

MoveIt add collision box coordinates system understanding

asked 2021-04-01 06:18:55 -0500

Ranjit Kathiriya gravatar image

updated 2021-04-22 11:12:56 -0500

miura gravatar image

Hey there,

Anyone can help me understanding moveIt coordinates system while adding collisions. I am attaching the code and I want an understanding of one lines.

Src of code : Moveit tutorials : moveit_tutorials/doc/collision_environments/scripts/collision_scene_example.py

from __future__ import print_function

import rospy
from moveit_commander import RobotCommander, PlanningSceneInterface
import geometry_msgs.msg
import time
import sys

class CollisionSceneExample(object):

    def __init__(self):
        self._scene = PlanningSceneInterface()

        # clear the scene
        self._scene.remove_world_object()

        self.robot = RobotCommander()

        # pause to wait for rviz to load
        print("============ Waiting while RVIZ displays the scene with obstacles...")

        # TODO: need to replace this sleep by explicitly waiting for the scene to be updated.
        rospy.sleep(2)

    def add_one_box(self):
        box1_pose = [0.25, 0.25, 0.0, 0, 0, 0, 1]
        box1_dimensions = [0.25, 0.25, 0.75]

        self.add_box_object("box1", box1_dimensions, box1_pose)

I want the explanation of below line:

        box1_pose = [0.25, 0.25, 0.0, 0, 0, 0, 1]  # Over here arg_1 = X pos, arg_2 = Y pos, arg_3 = Z pos, What about others?

Thanks for helping!

edit retag flag offensive close merge delete

Comments

1

Closed for the following reason spam or advertising

I doubt this is "spam or advertising".

In addition, we don't close questions here on ROS Answers when they've been answered.

Simply click on the checkmark of the answer you feel best answers your question. It will turn green, and will clearly mark the question as answered.

gvdhoorn gravatar image gvdhoorn  ( 2021-04-02 07:21:33 -0500 )edit

Actually, this question was silly. I have not seen a proper code and posted a question, that was the reason for closing this question.

Ranjit Kathiriya gravatar image Ranjit Kathiriya  ( 2021-04-02 10:25:40 -0500 )edit

I understand, but that's how Q&A sites work. It's rare that someone is the only one to have a question, and hopefully the next person who has this one will google it and find it answered for them.

fvd gravatar image fvd  ( 2021-04-02 10:31:18 -0500 )edit

Okay! understood and thanks for the help! @gvdhroom and @fvd

Ranjit Kathiriya gravatar image Ranjit Kathiriya  ( 2021-04-02 10:44:19 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-04-01 06:23:51 -0500

fvd gravatar image

The function add_box_object is defined further down in the same file, and it shows that those are the quaternion components that define the orientation:

def add_box_object(self, name, dimensions, pose):
    p = geometry_msgs.msg.PoseStamped()
    p.header.frame_id = self.robot.get_planning_frame()
    p.header.stamp = rospy.Time.now()
    p.pose.position.x = pose[0]
    p.pose.position.y = pose[1]
    p.pose.position.z = pose[2]
    p.pose.orientation.x = pose[3]
    p.pose.orientation.y = pose[4]
    p.pose.orientation.z = pose[5]
    p.pose.orientation.w = pose[6]
edit flag offensive delete link more

Comments

Sorry! for the silly question. How can I forget that. Omg! Really have to take a rest. Haha

Ranjit Kathiriya gravatar image Ranjit Kathiriya  ( 2021-04-01 06:26:37 -0500 )edit

Thanks for helping!

Ranjit Kathiriya gravatar image Ranjit Kathiriya  ( 2021-04-01 06:26:50 -0500 )edit

Can I close this question? I don't think it will be helpful

Ranjit Kathiriya gravatar image Ranjit Kathiriya  ( 2021-04-01 06:27:28 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2021-04-01 06:18:55 -0500

Seen: 279 times

Last updated: Apr 01 '21