# Defining C-space state for an arm in OMPL

I'm very new to Robotics, so please bear with my ignorance about the subject. That said, I'm trying to use Open Motion Planning Library (OMPL) to set up the configuration space for a robotic arm modeled after the human arm. In my model, the shoulder has 3 DOFs for translation and 3 DOFs for rotation. The elbow has only 1 DOF in rotation.

What would the correct way to setup the state space in OMPL? I can think of the following ways:

My confusion comes from the fact that since different dimensions of my C state space will have different bounds then, correct me if I'm wrong, shouldn't those be normalized to a common range before distance computations? Otherwise, they'll contribute disproportionately to the distance. If OMPL does this automatically, will it do this for both $$R^7$$ as well as the compound state space?

Another source of confusion is that one also needs to assign weights to individual subspaces in the compound state space. What's the rationale for having weights? Is it just to prioritize some motions over the others?

I think what you need in this case is a real vector state space.

You can have different bounds for each variable of your state space:

ob::RealVectorStateSpace* jointSpace(new ob::RealVectorStateSpace(_ndof));
ob::RealVectorBounds bounds(_ndof);

std::vector<double> lower_limits(_ndof);
std::vector<double> upper_limits(_ndof);

bounds.setLow(0, SOME_LIMIT);
bounds.setHigh(0, SOME_LIMIT);
//.
//.
//.
bounds.setLow(n, SOME_LIMIT);
bounds.setHigh(n, SOME_LIMIT);

jointSpace->setBounds(bounds);

• While I understand that the code snippet is only an example, I would suggest avoiding the new keyword to create raw pointers and use unique pointers instead. It helps avoid memory leaks. – Akshay Kumar Jan 31 at 18:08