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

PGAM's profile - activity

2021-07-28 22:46:58 -0500 received badge  Great Question (source)
2014-02-24 00:37:40 -0500 received badge  Good Question (source)
2012-09-12 02:54:40 -0500 received badge  Notable Question (source)
2012-09-12 02:54:40 -0500 received badge  Famous Question (source)
2012-07-27 01:42:27 -0500 received badge  Popular Question (source)
2011-06-14 12:28:11 -0500 marked best answer File conversion from *.urdf to *.xacro.

There is no official or programmatic way of doing this, as the process is strongly dependent on the platform that you are using.

When converting from a URDF to a xacro file, I did the following:

  • Create properties for commonly-used constants
    • Mathematics constants: M_PI, M_2PI
    • Conversion constants: Radians to Degrees, inches to centimeters
    • Physics constants: Speed of Light, gravity (if needed)
  • Create properties for variable components of your robot (Parts that will be constant over a run, but may change between runs)
    • Wheel Radius
    • Ground Clearance
    • Camera Height/Angle
  • Create macros for arrays of parts on your robot (a good example would be the super-structure of the turtlebot).
  • Create macros for any components that are "mirrored"
    • arms
    • wheels

This would be a good starting point for creating a xacro file, in general.

Edit:

See this tutorial for further details and syntax.

2011-06-13 06:43:32 -0500 received badge  Nice Question (source)
2011-06-13 05:56:55 -0500 received badge  Student (source)
2011-06-13 05:24:54 -0500 asked a question File conversion from *.urdf to *.xacro.

How we can convert a hand-written URDF file to a .xacro file (xml macro for generating URDF files) for robot and world models?

GDSP

2011-05-10 06:19:49 -0500 asked a question I am having an error form my main file. any suggestions please

Error:


/home/bostan/ROS/gam_driver/amtec_driver/ros/src/amtec_driver.cpp:173: error: no matching function for call to ‘ros::NodeHandle::advertiseService(const char [5], bool (PowercubeChainNode::)(int), PowercubeChainNode const)’

/opt/ros/cturtle/ros/core/roscpp/include/ros/node_handle.h:1022: note: candidates are: ros::ServiceServer ros::NodeHandle::advertiseService(ros::AdvertiseServiceOptions&)

main file class info:


class PowercubeChainNode

{

//

public:

/// create a handle for this node, initialize node

ros::NodeHandle n_;

---

---

---

// declaration of service servers

ros::ServiceServer srvServer_Init_;

ros::ServiceServer srvServer_Stop_;

ros::ServiceServer srvServer_Recover_;

ros::ServiceServer srvServer_SetOperationMode_;

ros::ServiceServer srvServer_SetDefaultVel_;

----

----

----

// implementation of service servers

srvServer_Init_ = n_.advertiseService("init", &PowercubeChainNode::srvCallback_Init, this);

srvServer_Stop_ = n_.advertiseService("stop", &PowercubeChainNode::srvCallback_Stop, this);

srvServer_Recover_ = n_.advertiseService("recover", &PowercubeChainNode::srvCallback_Recover, this);

srvServer_SetOperationMode_ = n_.advertiseService("set_operation_mode", &PowercubeChainNode::srvCallback_SetOperationMode, this);

srvServer_SetDefaultVel_ = n_.advertiseService("set_default_vel", &PowercubeChainNode::srvCallback_SetDefaultVel, this);


-----

-----

-----

}

relevant methods from "NodeHandle" class


template<class T, class MReq, class MRes>

ServiceServer advertiseService(const std::string& service, bool(T::*srv_func)(MReq &, MRes &), T *obj)

{

AdvertiseServiceOptions ops;

ops.template init<MReq, MRes>(service, boost::bind(srv_func, obj, _1, _2));

return advertiseService(ops);

}

-------------------------------------------------------------------------------------------

template<class T, class MReq, class MRes>

ServiceServer advertiseService(const std::string& service, bool(T::*srv_func)(ServiceEvent<MReq, MRes>&), T *obj)

{

AdvertiseServiceOptions ops;

ops.template initBySpecType<ServiceEvent<MReq, MRes> >(service, boost::bind(srv_func, obj, _1));

return advertiseService(ops);

}

------------------------------------------------------------------------------------------


template<class T, class MReq, class MRes>

ServiceServer advertiseService(const std::string& service, bool(T::*srv_func)(MReq &, MRes &), const boost::shared_ptr<T>& obj)

{

AdvertiseServiceOptions ops;

ops.template init<MReq, MRes>(service, boost::bind(srv_func, obj.get(), _1, _2));

ops.tracked_object = obj;

return advertiseService(ops);

}

---------------------------------------------------------------------------------------

template<class T, class MReq, class MRes>

ServiceServer advertiseService(const std::string& service, bool(T::*srv_func)(ServiceEvent<MReq, MRes>&), const boost::shared_ptr<T>& obj)

{

AdvertiseServiceOptions ops;

ops.template initBySpecType<ServiceEvent<MReq, MRes> >(service, boost::bind(srv_func, obj.get(), _1));

ops.tracked_object = obj;

return advertiseService(ops);

}

-------------------------------------------------------------------------------------------

template<class MReq, class MRes>

ServiceServer advertiseService(const std::string& service, bool(*srv_func)(MReq&, MRes&))

{

AdvertiseServiceOptions ops;

ops.template init<MReq, MRes>(service, srv_func);

return advertiseService(ops);

}

--------------------------------------------------------------------------------

template<class MReq, class MRes>

ServiceServer advertiseService(const std::string& service, bool(*srv_func)(ServiceEvent<MReq, MRes>&))

{

AdvertiseServiceOptions ops;

ops.template initBySpecType<ServiceEvent<MReq, MRes> >(service, srv_func);

return advertiseService(ops);

}

----------------------------------------------------------------------------------------


template<class MReq, class MRes>

ServiceServer advertiseService(const std::string& service, const boost::function<bool(MReq&, MRes&)>& callback, const VoidConstPtr& tracked_object = VoidConstPtr())

{

AdvertiseServiceOptions ops;

ops.template init<MReq, MRes>(service, callback);

ops.tracked_object = tracked_object;

return advertiseService(ops);

}

-----------------------------------------------------------------------

template<class S>

ServiceServer advertiseService(const std::string& service, const boost::function<bool(S&)>& callback, const VoidConstPtr& tracked_object = VoidConstPtr())

{    

AdvertiseServiceOptions ops;

ops.template initBySpecType<S>(service, callback);

ops.tracked_object = tracked_object;

return advertiseService(ops);

}

--------------------------------------------------------------

ServiceServer advertiseService(AdvertiseServiceOptions& ops);