วันพฤหัสบดีที่ 30 กันยายน พ.ศ. 2553

NOte for ROS stuff : )

NodeHandle
http://www.ros.org/wiki/roscpp/Overview/NodeHandles
param searchParam
http://www.ros.org/wiki/roscpp_tutorials/Tutorials/Parameters
subscribe to Topic API
http://www.ros.org/doc/api/roscpp/html/classros_1_1NodeHandle.html#ac8600d1dda9123e4562072500e0784b7
Tf API in C++
http://www.ros.org/doc/api/tf/html/c++/namespacetf.html

Navigation for robot, local_costmap, global_costmap, map_server
http://www.ros.org/wiki/navigation/Tutorials/RobotSetup
Using Custom Maps in Simulation
http://www.ros.org/wiki/pr2_simulator/Tutorials/UsingCustomMapForSimulation
Messages and frame_id
http://www.ros.org/wiki/Messages
Robot controller using keyboard
http://www.ros.org/wiki/pr2_controllers/Tutorials/Using%20the%20robot%20base%20controllers%20to%20drive%20the%20robot
Move base
http://www.ros.org/wiki/move_base

Laser Scan
http://www.ros.org/wiki/laser_pipeline/Tutorials/IntroductionToWorkingWithLaserScannerData
How to put 3D models into Gazebo simulation
http://www.ros.org/wiki/ogre_tools/STL_To_Ogre_Mesh_Converter
Directory for texture list
/home/jednipat/ros/stacks/simulator_gazebo/gazebo/gazebo/share/gazebo/Media/materials/scripts
-Gazebo/White
-Gazebo/Grey
-Gazebo/Eyes
-Gazebo/FlatBlack
-Gazebo/Black
-Gazebo/Red
-Gazebo/Green
-Gazebo/RedEmissive
-Gazebo/GreenEmissive
-Gazebo/BlueLaser
-Gazebo/BlueEmissive
-Gazebo/JointAnchor
-Gazebo/Blue
-Gazebo/Skull
-Gazebo/ExclamationPoint
-Gazebo/QuestionMark
-Gazebo/SmileyHappy
-Gazebo/SmileySad
-Gazebo/SmileyDead
-Gazebo/SmileyPlain
-Gazebo/WoodFloor
-Gazebo/CeilingTiled
-Gazebo/PaintedWall
-Gazebo/PioneerBody
-Gazebo/Pioneer2Body
-Gazebo/Gold
-Gazebo/CloudySky
-Gazebo/RustySteel
-Gazebo/Chrome
-Gazebo/BumpyMetal
-Gazebo/GrayGrid
-Gazebo/Rocky
-Gazebo/GrassFloor
-Gazebo/Rockwall
-Gazebo/RustyBarrel
-Gazebo/WoodPallet
-Gazebo/Fish
-Gazebo/LightWood
-Gazebo/WoodTile
-Gazebo/Brick
-Gazebo/TransparentTest
-Gazebo/DepthMap
-Gazebo/PCBGreen
-Gazebo/Turret
-Gazebo/EpuckBody
-Gazebo/EpuckRing
-Gazebo/EpuckPlate
-Gazebo/EpuckLogo
-Gazebo/EpuckMagenta
-Gazebo/EpuckGold

วันพุธที่ 28 กรกฎาคม พ.ศ. 2553

ROS Publisher and Subscriber

ROS publisher & subscriber

I just note for the important line of code from the ROS wiki.
The code below is used to define publisher in ROS system.

Publisher

ros::NodeHandle n;
ros::Publisher chatter_pub = n.advertise<std_msgs::String>("chatter", 100);

chatter_put is Publisher object.
n.advertise("topicname",numberofMessage);

To publish message, we can use the following code:

msg.data = datatobepublish; // assign message for publish
chatter_put.publish(msg); // Call publish method of Publisher class

Subscriber

A subscriber must define callback function that will get called when a new message have arrived on the chatter topic.

Define callback function:

void chatterCallback(const std_msgs::StringConstPtr& msg)
{
ROS_INFO("Received [%s]",msg->data.c_str());
}

Define nodeHandle and call subscribe function

ros
::NodeHandle n;
ros::Subscriber chatter_sub = n.subscribe("chatter", 100, chatterCallback);

The line above means that

nodeObject.subscribe("publisherTopicName",numberOfMsgInQue,callbackFunctionName);


Reference: http://www.ros.org/wiki/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29