求ABO之无法标记by无所谓微盘,无所谓的

用ros publisher发布cmd_vel命令(python)
用ros publisher发布cmd_vel命令(python)
参考ros wiki的链接
本文实现的是将本地生成的一系列控制指令,从csv文件中读取,并以一定的频率发布给机器人。
首先介绍cmd_vel的数据类型
#This expresses velocity in free space broken into its linear and angular parts.
由三维的速度控制指令和三维的角度控制指令组成,一般就取linear.x和angular.z即可
我们需要写如下代码,才能正常使用该数据类型
from geometry_msgs.msg import Twist
接下来是读取csv文件,用csv.reader可以很方便的实现
read=csv.reader(csvfile)
for row in read:
xxx=','.join(row)
para =xxx.split(',')
vel=para[0]
ang=para[1]
xxx返回了csv文件中每行的两个数据,以逗号分隔,para则是以逗号为分隔符将两个数据分别提取出来保存到数组中,下面用vel,ang两个变量分别保存。
有了数据,还需要一步
msg = Twist() #初始化
msg.linear.x=float(vel)
msg.angular.z=float(ang)
最后我们就可以发布了
pub.publish(msg)
完整代码如下
import rospy
import csv
from geometry_msgs.msg import Twist
csvfile=file('your/csv/file.csv','r')
read=csv.reader(csvfile)
def talker():
pub = rospy.Publisher('/jackal_velocity_controller/cmd_vel', Twist,queue_size=10)
rospy.init_node('talker', anonymous=True)
rate = rospy.Rate(50)
msg = Twist()
while not rospy.is_shutdown():
for row in read:
xxx=','.join(row)
para =xxx.split(',')
vel=para[0]
ang=para[1]
msg.linear.x=float(vel)
msg.angular.z=float(ang)
pub.publish(msg)
rate.sleep()
if __name__ == '__main__':
except rospy.ROSInterruptException:
我的热门文章
即使是一小步也想与你分享15381人阅读
robot operating system(19)
&&&& 节点是一个可执行程序,它连接到了ROS的网络系统中。我们将会创建一个发布者,也就是说话者节点,它将会持续的广播一个信息。
&&&& 改变目录到之前所建立的那个包下:
cd ~/catkin_ws/src/beginner_tutorials
&&&& 在beginner_tutorials包下面建立一个src文件夹:
mkdir -p ~/catkin_ws/src/beginner_tutorials/src
&&&& 创建文件src/talker.cpp:
vim src/talker.cpp
&&&& 将下面的内容复制进去:
#include &ros/ros.h&
#include &std_msgs/String.h&
#include &sstream&
* This tutorial demonstrates simple sending of messages over the ROS system.
int main(int argc, char **argv)
* The ros::init() function needs to see argc and argv so that it can perform
* any ROS arguments and name remapping that were provided at the command line. For programmatic
* remappings you can use a different version of init() which takes remappings
* directly, but for most command-line programs, passing argc and argv is the easiest
* way to do it.
The third argument to init() is the name of the node.
* You must call one of the versions of ros::init() before using any other
* part of the ROS system.
ros::init(argc, argv, &talker&);
* NodeHandle is the main access point to communications with the ROS system.
* The first NodeHandle constructed will fully initialize this node, and the last
* NodeHandle destructed will close down the node.
ros::NodeH
* The advertise() function is how you tell ROS that you want to
* publish on a given topic name. This invokes a call to the ROS
* master node, which keeps a registry of who is publishing and who
* is subscribing. After this advertise() call is made, the master
* node will notify anyone who is trying to subscribe to this topic name,
* and they will in turn negotiate a peer-to-peer connection with this
advertise() returns a Publisher object which allows you to
* publish messages on that topic through a call to publish().
* all copies of the returned Publisher object are destroyed, the topic
* will be automatically unadvertised.
* The second parameter to advertise() is the size of the message queue
* used for publishing messages.
If messages are published more quickly
* than we can send them, the number here specifies how many messages to
* buffer up before throwing some away.
ros::Publisher chatter_pub = n.advertise&std_msgs::String&(&chatter&, 1000);
ros::Rate loop_rate(10);
* A count of how many messages we have sent. This is used to create
* a unique string for each message.
int count = 0;
while (ros::ok())
* This is a message object. You stuff it with data, and then publish it.
std_msgs::S
ss && &hello world & &&
msg.data = ss.str();
ROS_INFO(&%s&, msg.data.c_str());
* The publish() function is how you send messages. The parameter
* is the message object. The type of this object must agree with the type
* given as a template parameter to the advertise&&() call, as was done
* in the constructor above.
chatter_pub.publish(msg);
ros::spinOnce();
loop_rate.sleep();
++
保存退出。
&&&& 解释一下代码:
#include &ros/ros.h&
ros/ros.h包括了使用ROS系统最基本的头文件。
#include &std_msgs/String.h&
这条代码包括了std_msgs/String消息,它存在于std_msgs包中。这是有std_msgs中的String.msg文件自动产生的。
ros::init(argc, argv, &talker&);
初始化ROS,它允许ROS通过命令行重新命名,现在还不太重要。这里也是我们确切说明节点名字的地方,在运行的系统中,节点的名字必须唯一。
ros::NodeH
为处理的节点创建了一个句柄,第一个创建的节点句柄将会初始化这个节点,最后一个销毁的节点将会释放节点所使用的所有资源。
ros::Publisher chatter_pub = n.advertise&std_msgs::String&(&chatter&, 1000);
告诉主机,我们将会在一个名字为chatter的话题上发布一个std_msgs/String类型的消息,这就使得主机告诉了所有订阅了chatter话题的节点,我们将在这个话题上发布数据。第二个参数是发布队列的大小,它的作用是缓冲。当我们发布消息很快的时候,它将能缓冲1000条信息。如果慢了的话就会覆盖前面的信息。
NodeHandle::advertise()将会返回ros::Publisher对象,该对象有两个作用,首先是它包括一个publish()方法可以在制定的话题上发布消息,其次,当超出范围之外的时候就会自动的处理。
ros::Rate loop_rate(10);
一个ros::Rate对象允许你制定循环的频率。它将会记录从上次调用Rate::sleep()到现在为止的时间,并且休眠正确的时间。在这个例子中,设置的频率为10hz。
int count = 0;
while (ros::ok())
默认情况下,roscpp将会安装一个SIGINT监听,它使当Ctrl-C按下时,ros::ok()将会返回false。
ros::ok()在以下几种情况下也会返回false:(1)按下Ctrl-C时(2)我们被一个同名同姓的节点从网络中踢出(3)ros::shutdown()被应用程序的另一部分调用(4)所有的ros::NodeHandles都被销毁了。一旦ros::ok()返回false,所有的ROS调用都会失败。
std_msgs::S
ss && &hello world & &&
msg.data = ss.str();
我们使用message-adapted类在ROS中广播信息,这个类一般是从msg文件中产生的。我们现在使用的是标准的字符串消息,它只有一个data数据成员,当然更复杂的消息也是可以的。
chatter_pub.publish(msg);
现在我们向话题chatter发布消息。
ROS_INFO(&%s&, msg.data.c_str());
ROS_INFO是cout和printf的替代品。
ros::spinOnce();
在这个简单的程序中调用ros::spinOnce();是不必要的,因为我们没有收到任何的回调信息。然而如果你为这个应用程序添加一个订阅者,并且在这里没有调用ros::spinOnce(),你的回调函数将不会被调用。所以这是一个良好的风格。
loop_rate.sleep();
休眠一下,使程序满足前面所设置的10hz的要求。
&&&& 下面总结一下创建一个发布者节点的步骤:(1)初始化ROS系统(2)告诉主机我们将要在chatter话题上发布std_msgs/String类型的消息(3)循环每秒发送10次消息。
&&相关文章推荐
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:555959次
积分:5168
积分:5168
排名:第4732名
原创:86篇
转载:20篇
评论:210条
文章:15篇
阅读:93498
文章:15篇
阅读:21164
(1)(1)(2)(6)(1)(3)(5)(1)(4)(2)(11)(6)(17)(17)(30)ROS中已经定义了较多的标准类型的消息,你可以用在这些标准类型的消息上再自定义自己的消息类型。这个在复杂数据传输很有用,例如节点和服务器进行交互时,就可能用到传输多个参数到服务器,并返回相应的结果。为了保证例子的完整,将详述每一步。
基本思路和创建talker和listener的例子类似,步骤如下:
建立工作空间workspace(类似于vs下的解决方案,用来管理很多的项目);
建立包package(类似于vs下的项目);
创建msg和srv文件;
编写服务节点和客户节点代码;
利用rosmake进行编译(catkin_make也可以,但稍有不同,请参考另一篇博文的);
利用rosrun运行;
1.1、创建工作空间
在开始具体工作之前,首先创建工作空间,并且为工作空间设置环境变量到~/.bashrc中,如果要查看已有的空间路径,可以用查询命令
$ echo $ROS_PACKAGE_PATH
你将会看到如下的信息:
/home/horsetail/dev/rosbook:/home/horsetail/catkin_ws/src:/opt/ros/jade/share:/opt/ros/jade/stacks
这里的创建空间实际上就是先建立一个文件夹,然后把文件夹的路径设置到环境变量~/.bashrc中。例如我们这里创建目录~/dev/rosbook作为工作空间。
首先执行命令:
$ mkdir -p dev/rosbook
然后将创建的路径加入到环境变量中,执行如下命令:
$ echo "export ROS_PACKAGE_PATH=~/dev/rosbook:${ROS_PACKAGE_PATH}" && ~/.bashrc
$ . ~/.bashrc
这样,我们就完成了工作空间的配置,注意:ROS安装的时候,一定要把ROS的环境变量也加到~/.bashrc中。这里还需要把ROS。接下来就是在这个空间下创建包了。
1.2、创建包
&可以手动创建包,但是非常的繁琐,为了方便,最好使用roscreate-pkg命令行工具,该命令行的格式如下:
roscreate-pkg [package_name] [depend1] [depend2] [depend3] ...
命令行包含了要创建包的名字,依赖包。
我们的例子中,创建一个叫mypacakge1的 新包,命令如下:
$ cd ~/dev/rosbook
$ roscreate-pkg mypackage1 std_msgs roscpp rospy
过一会弹出如下的信息,表示创建成功:
Created package directory /home/horsetail/dev/rosbook/mypackage1
Created include directory /home/horsetail/dev/rosbook/mypackage1/include/mypackage1
Created cpp source directory /home/horsetail/dev/rosbook/mypackage1/src
Created package file /home/horsetail/dev/rosbook/mypackage1/Makefile
Created package file /home/horsetail/dev/rosbook/mypackage1/manifest.xml
Created package file /home/horsetail/dev/rosbook/mypackage1/CMakeLists.txt
Created package file /home/horsetail/dev/rosbook/mypackage1/mainpage.dox
Please edit mypackage1/manifest.xml and mainpage.dox to finish creating your package
好了这样就完成了包的创建,我们发现在mypackage1的目录下有一个src文件夹,我们接下来就是网这里添加源程序了。
1.3、创建msg和srv文件
&首先,在mypackage1功能包下,创建msg文件夹,并在其中创建一个新的文件mypackage_msg1.msg,将在这个文件里自定义消息的类型,在文件中添加以下代码:
现在编辑CMakeList.txt,从#rosbuild_genmsg()这一行中删除#,然后使用rosmake命令编译功能包:
$ rosmake mypackage1
为了检查正确性,使用rosmsg命令:
$ rosmsg show mypackage1/mypackage1_msg1
如果看到的内容和文件一样,说明编译正确。
现在新建一个srv文件,在mypackage1文件夹下建立srv文件夹,并在srv文件夹下新建一个文件mypackage1_srv1.srv,并添加以下代码:
编辑CMakeList.txt,从#rosbuild_genmsg()这一行中删除#,然后使用rosmake命令编译功能包,可以通过一下命令验证正确性:
$ rossrv show mypackage1/mypackage1_srv1
如果看到的内容和文件一样,说明编译正确。
1.4、编写服务节点和客户节点代码
接下来建立用于验证服务中请求响应的代码,在mypackage1/src下新建文件example_srv_request.cpp,添加如下代码:
#include "ros/ros.h"
#include "mypackage1/mypackage_srv1.h"
bool add(chapter2_tutorials::chapter2_srv1::Request
chapter2_tutorials::chapter2_srv1::Response &res)
res.sum = req.A + req.B + req.C;
ROS_INFO("request: A=%ld, B=%ld C=%ld", (int)req.A, (int)req.B, (int)req.C);
ROS_INFO("sending back response: [%ld]", (int)res.sum);
return true;
int main(int argc, char **argv)
ros::init(argc, argv, "add_3_ints_server");
ros::NodeH
ros::ServiceServer service = n.advertiseService("add_3_ints", add);
ROS_INFO("Ready to add 3 ints.");
ros::spin();
在mypackage1/src下新建文件example_srv_respone.cpp,添加如下代码:
#include "ros/ros.h"
#include "mypackage1/mypackage_srv1.h"
#include &cstdlib&
int main(int argc, char **argv)
ros::init(argc, argv, "add_3_ints_client");
if (argc != 4)
ROS_INFO("usage: add_3_ints_client A B C ");
ros::NodeH
ros::ServiceClient client = n.serviceClient&chapter2_tutorials::chapter2_srv1&("add_3_ints");
chapter2_tutorials::chapter2_srv1
srv.request.A = atoll(argv[1]);
srv.request.B = atoll(argv[2]);
srv.request.C = atoll(argv[3]);
if (client.call(srv))
ROS_INFO("Sum: %ld", (long int)srv.response.sum);
ROS_ERROR("Failed to call service add_two_ints");
接下来建立用于验证消息传递的代码,在mypackage1/src下新建文件example_talker_msg.cpp,添加如下代码:
#include "ros/ros.h"
#include "mypackage1/mypackage1_msg1.h"
#include &sstream&
int main(int argc, char **argv)
ros::init(argc, argv, "example_talker_msg");
ros::NodeH
ros::Publisher pub = n.advertise&chapter2_tutorials::chapter2_msg1&("message", 1000);
ros::Rate loop_rate(10);
while (ros::ok())
chapter2_tutorials::chapter2_msg1
msg.A = 1;
msg.B = 2;
msg.C = 3;
pub.publish(msg);
ros::spinOnce();
loop_rate.sleep();
在mypackage1/src下新建文件example_listener_msg.cpp,添加如下代码:
#include "ros/ros.h"
#include "mypackage1/mypackage1_msg1.h"
void messageCallback(const chapter2_tutorials::chapter2_msg1::ConstPtr& msg)
ROS_INFO("I heard: [%d] [%d] [%d]", msg-&A, msg-&B, msg-&C);
int main(int argc, char **argv)
ros::init(argc, argv, "example_listener_msg");
ros::NodeH
ros::Subscriber sub = n.subscribe("message", 1000, messageCallback);
ros::spin();
好了,至此完成了服务和消息的测试代码编写。
1.5、利用rosmake进行编译
&接下来,要告诉编译器如何去找到这两个文件。你需要打开mypackage1/CMakeLists.txt,在文件的末尾添加两行命令:
rosbuild_add_executable(example_srv_request src/example_srv_request.cpp)
rosbuild_add_executable(example_srv_respone src/example_srv_respone.cpp)
rosbuild_add_executable(example_talker_msg src/example_talker_msg.cpp)
rosbuild_add_executable(example_listener_msg src/example_listener_msg.cpp)
&添加后的文件结构是这样的:
cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
# Set the build type.
Options are:
: w/ debug symbols, w/o optimization, w/ code-coverage
: w/ debug symbols, w/o optimization
: w/o debug symbols, w/ optimization
RelWithDebInfo : w/ debug symbols, w/ optimization
MinSizeRel
: w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE RelWithDebInfo)
rosbuild_init()
#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
#uncomment if you have defined messages
rosbuild_genmsg()
#uncomment if you have defined services
rosbuild_gensrv()
#common commands for building c++ executables and libraries
rosbuild_add_executable(example_srv_request src/example_srv_request.cpp)
rosbuild_add_executable(example_srv_respone src/example_srv_respone.cpp)
rosbuild_add_executable(example_talker_msg src/example_talker_msg.cpp)
rosbuild_add_executable(example_listener_msg src/example_listener_msg.cpp)
&这样用rosmake命令来编译这个mypackage1包了。执行下面的命令:
$ rosmake mypackage1
输出下面的信息:
horsetail@horsetail-book:~$ roscore
... logging to /home/horsetail/.ros/log/6eae5b9c-628d-11e5-8bd7-/roslaunch-horsetail-book-6447.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is &1GB.
started roslaunch server http://horsetail-book:44362/
ros_comm version 1.11.13
PARAMETERS
* /rosdistro: jade
* /rosversion: 1.11.13
auto-starting new master
process[master]: started with pid [6459]
ROS_MASTER_URI=http://horsetail-book:11311/
...(内容太长了,省去)
[ rosmake ] Results:
[ rosmake ] Built 26 packages with 0 failures.
[ rosmake ] Summary output to directory
[ rosmake ] /home/horsetail/.ros/rosmake/rosmake_output--164014
哇,编译通过,大家注意到实际上也是用catkin进行编译的,额。我们来运行一下吧。
首先打开一个新的终端,启动初始化ROS,执行命令:
先验证一下服务请求和相应的功能,需要在不同窗口分别执行以下命令:
rosrun mypackage1 example_talker_msg
rosrun mypackage1 example_listener_msg
可以看到请求listener的窗口,显示如下信息:
[ INFO] [.]: I heard:[1][2][3]
[ INFO] [.]: I heard:[1][2][3]
[ INFO] [.]: I heard:[1][2][3]
好了至此完成了服务srv和消息msg的验证。&
最后,附上源码:(这个是ROS机器人程序设计中第二章的例子,里面包含了消息和服务等例子)
[1]. Aaron Martinez Enrique Fern andez, ROS机器人程序设计[B], P14-42, 2014.
阅读(...) 评论()机器人+ROS(65)
上一节我们完成了 message & srv 文件的创建和加入编译,这次我们要玩简单的Publisher 和 Subscriber
要玩 Publisher 和 Subscriber, 需要具备的条件有哪些呢?先总结一下:
&创建并生成自己的Package,本次是 beginner_tutorials&创建并生成ROS message & srv
详细版的手记要看我上传到百度文库的文件了:/view/ffff705cc170ade
这里会写个总结~
This tutorial covers how to write a publisher and subscriber node in C++.
ROS学习笔记10 - 编写编译和检验Service Node
百度文库:/view/e14d5e18dd88d0d232d46a37
Writing a Service Node
Here we'll create the service (&add_two_ints_server&)node which will receive two ints and return the sum.
Change directories to your beginner_tutorialspackage you created in your catkin workspace previous tutorials:
cd ~/catkin_ws/src/beginner_tutorials
Please make sure you have followed the directions in the previous tutorialfor creating the service needed in this tutorial, (be sure to choose the rightversion of build tool you're using at the top of wiki page in the link).
Create the src/add_two_ints_server.cpp file within the
beginner_tutorialspackage and paste the following inside it:
#include &ros/ros.h&
#include &beginner_tutorials/AddTwoInts.h&
bool add(beginner_tutorials::AddTwoInts::Request& &req,
&&&&&&&&beginner_tutorials::AddTwoInts::Response &res)
& res.sum = req.a + req.b;
& ROS_INFO(&request:x=%ld, y=%ld&, (long int)req.a, (long int)req.b);
& ROS_INFO(&sendingback response: [%ld]&, (long int)res.sum);
int main(int argc, char **argv)
& ros::init(argc, argv, &add_two_ints_server&);
& ros::NodeH
& ros::ServiceServer service = n.advertiseService(&add_two_ints&,add);
& ROS_INFO(&Readyto add two ints.&);
& ros::spin();
& return 0;
The Code Explained
Now, let's break the code down.
#include &ros/ros.h&
#include &beginner_tutorials/AddTwoInts.h&
beginner_tutorials/AddTwoInts.h is the header file generated fromthe srv file that we created earlier. 位置:~/catkin_ws/include/beginner_tutorials
bool add(beginner_tutorials::AddTwoInts::Request&&req,
&&&&&&&&beginner_tutorials::AddTwoInts::Response &res)
This function provides the service for adding two ints,it takes in the request and response type defined in the srvfile(AddTwoInts.srv) and returns a boolean.
& res.sum = req.a + req.b;
& ROS_INFO(&request:x=%ld, y=%ld&, (long int)req.a, (long int)req.b);
& ROS_INFO(&sendingback response: [%ld]&, (long int)res.sum);
Here the two ints are added and stored in theresponse. Then some information about the request and response are logged.Finally the service returns true when it is complete.
ros::ServiceServerservice = n.advertiseService(&add_two_ints&, add);
Here the service is created and advertised over ROS.
对比一下前一节publisher nodes的创建:
&ros::Publisher&chatter_pub&=&n.advertise&std_msgs::String&(&chatter&,&1000);& //topic name “chatter”, bufferSize:1000
对比一下后面client相关声明语句:
ros::ServiceClient client = n.serviceClient&beginner_tutorials::AddTwoInts&(&add_two_ints&);
This creates a client for the add_two_ints service. The ros::ServiceClient object is used to call the service later on.
Writing the Client Node
Create the src/add_two_ints_client.cpp file within the
beginner_tutorialspackage and paste the following inside it:
#include &ros/ros.h&
#include &beginner_tutorials/AddTwoInts.h&
#include &cstdlib&
int main(int argc, char **argv)
& ros::init(argc, argv, &add_two_ints_client&);
& if (argc != 3)
&&& ROS_INFO(&usage:add_two_ints_client X Y&);
&&& return1;
& ros::NodeH
& ros::ServiceClient client = n.serviceClient&beginner_tutorials::AddTwoInts&(&add_two_ints&);
& beginner_tutorials::AddTwoI
& srv.request.a= atoll(argv[1]);
& srv.request.b= atoll(argv[2]);
& if (client.call(srv))
&&& ROS_INFO(&Sum:%ld&, (long int)srv.response.sum);
&&& ROS_ERROR(&Failedto call service add_two_ints&);
&&& return1;
& return 0;
The Code Explained
Now, let's break the code down.
& ros::ServiceClient client = n.serviceClient&beginner_tutorials::AddTwoInts&(&add_two_ints&);
This creates a client for the add_two_intsservice. The ros::ServiceClient object is used to call the service later on.
& beginner_tutorials::AddTwoI
& srv.request.a= atoll(argv[1]);
& srv.request.b= atoll(argv[2]);
Here we instantiate列举 an autogenerated service class, and assignvalues into its request member.Aservice class contains two members,
requestand response.It alsocontains two class definitions,
Requestand Response.
& if (client.call(srv))
This actually calls the service. Since service calls are blocking, it willreturn once the call is done. If the service call succeeded, call()will return true and the value in srv.response willbe valid. If the call did not succeed, call() willreturn
false and the value in srv.response will beinvalid.
Building your nodes
Again edit the beginner_tutorials CMakeLists.txt located at ~/catkin_ws/src/beginner_tutorials/CMakeLists.txt and add the following at the end:
add_executable(add_two_ints_server src/add_two_ints_server.cpp)
target_link_libraries(add_two_ints_server ${catkin_LIBRARIES})
add_dependencies(add_two_ints_server beginner_tutorials_gencpp)
add_executable(add_two_ints_client src/add_two_ints_client.cpp)
target_link_libraries(add_two_ints_client ${catkin_LIBRARIES})
add_dependencies(add_two_ints_client beginner_tutorials_gencpp)
This will create two executables, add_two_ints_server and add_two_ints_client, which by default will go intopackage directory of your, located by default at ~/catkin_ws/devel/lib/share/&package&name&. You can invoke executablesdirectly or you can use rosrun to invoke调用 them. They are not placed in '&prefix&/bin' because that would pollute thePATH when installing your package to
the system. If you wish for your executableto be on the PATH at installation time, you can setup an install target, see:
For more detailed discription of the
Now run catkin_make:
# In your catkin workspace
cd ~/catkin_ws
catkin_make
If your build fails for some reason:
make sure you have followed the directions in the previous tutorial: .
Now that you have written a simple service and client, let's .
Examining the Simple Service and Client
Running the Service
Let's start by running the service:
$ rosrunbeginner_tutorials add_two_ints_server&&&& (C++)
$ rosrunbeginner_tutorials add_two_ints_server.py& (Python)
You should see something similar to:
Ready to add two ints.
Running the Client
Now let's run the client with the necessaryarguments:
$ rosrunbeginner_tutorials add_two_ints_client1 3&&&& (C++)
$ rosrunbeginner_tutorials add_two_ints_client.py 1 3& (Python)
You should see something similar to:
Requesting 1+3
1 + 3 = 4
Now that you've successfully run your first serverand client, let's learn how to.
Further examples on Service and Client nodes
If you want to investigate further and get ahands-on example, you can get one . A simple Client and Servicecombination shows the use of custom message types. The Service node is writtenin C++ while the Client is available in C++, Python and LISP.
&&相关文章推荐
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:214563次
积分:3730
积分:3730
排名:第7774名
原创:150篇
转载:41篇
评论:29条
文章:16篇
阅读:28108
文章:13篇
阅读:12620}

我要回帖

更多关于 无法标记by无所谓微盘 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信