I would second what Klaus recommends (i.e. find some glue and use it).<br><br>To answer your C# question, you can implement the communication layer of ROS. It will probably take a couple of weeks, though I imagine C# is harder. Of the other clients, only rospy and roscpp were implemented from scratch. The rest were implemented on top of roscpp. The hard part is that you'll have to write a message generator. Our format is simple, but serializers take time to get right, and the lack of a ROS build toolchain on Windows will probably make your workflow painful. The wire protocol itself is very simple and couple be done in a day or so if you're trying to do something simple.<br>

<br>However, there are a lot of middlewares out there, like ICE, and you just figure out what can bridge between C# on Windows and C++/Python on Linux. It will probably save you a lot of time and effort. ROS is more about the integration of a packaging system, online tools, and coding community -- not middleware. Until we get a more complete toolchain running on Windows, you might as well take a shortcut.<br>

<br> - Ken<br><br><br><div class="gmail_quote">On Tue, Jun 15, 2010 at 9:15 AM, Klaus Petersen <span dir="ltr"><<a href="mailto:petersen@vftb.com">petersen@vftb.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

Hi Aaron,<br>
<br>
I have done both, using the python framework to communicate from windows<br>
c++ with ros nodes on linux, and checked proprietary solutions. I will<br>
re-post what I think the easiest way is to communicate in the python way<br>
below. However, in the end I came to prefer to communicate between<br>
windows and ros using ice (<a href="http://www.zeroc.com" target="_blank">www.zeroc.com</a>) If you just need to pass some<br>
data, this is very easy to set up. Check the documentation, they have<br>
some examples for basic remote message calling for c# as well. Ice has<br>
of course a different scope than ros and can not substitute its<br>
functionality (except if you build your own framework around it), but as<br>
I said for quickly passing data it is excellent.<br>
<br>
Klaus<br>
<br>
<br>
The former post regarding windows / python / vc++ (not c# anyway):<br>
<br>
To receive ros standard messages (Float32 in this example) in vc++<br>
(thats what I checked it with) I did something like this:<br>
<br>
#undef _DEBUG<br>
#include <Python.h><br>
<br>
// the method that gets embedded into python<br>
static PyObject* ros_indirect_callback(PyObject *self, PyObject *args)<br>
{<br>
        double double_data;<br>
<br>
        if (!PyArg_ParseTuple(args, "d", &double_data))<br>
                return NULL;<br>
<br>
        printf("Do something with the data %f here.\n", double_data);<br>
<br>
        return Py_BuildValue("i", 0);<br>
}<br>
<br>
// some data in order to register the method<br>
static PyMethodDef embedded_methods[] =<br>
{<br>
        {<br>
                "ros_indirect_callback",<br>
                ros_indirect_callback,<br>
                METH_VARARGS,<br>
                ""<br>
        },<br>
        {<br>
                NULL,<br>
                NULL,<br>
                0,<br>
                NULL<br>
        }<br>
};<br>
<br>
// thread that runs the ros node (gets locked after calling spin())<br>
void ros_thread::run(void)<br>
{<br>
        Py_Initialize();<br>
        Py_InitModule("ros_win", embedded_methods);<br>
<br>
        PySys_SetArgv(0, argv);<br>
<br>
        PyRun_SimpleString("import ros_win\n"<br>
                "import roslib\n"<br>
                "import rospy\n"<br>
                "from std_msgs.msg import Float32" );<br>
<br>
        PyRun_SimpleString("def callback(data):\n"<br>
                "       ros_win.ros_indirect_callback(data.data)\n" );<br>
<br>
        PyRun_SimpleString("rospy.init_node('listener', anonymous=True)\n"<br>
                "rospy.Subscriber('chatter', Float32, callback)\n"<br>
                "rospy.spin()\n" );<br>
}<br>
<br>
<br>
To send messages:<br>
<br>
#undef _DEBUG<br>
#include <Python.h><br>
<br>
#include <string><br>
#include <boost/lexical_cast.hpp><br>
<br>
using namespace std;<br>
<br>
void send_double_data(double v)<br>
{<br>
        Py_Initialize();<br>
        PySys_SetArgv(0, argv);<br>
<br>
        string s_str = "str = " + boost::lexical_cast<std::string>(v);<br>
        PyRun_SimpleString(s_str.c_str());<br>
<br>
        PyRun_SimpleString("rospy.loginfo(str)\n"<br>
                "pub.publish(Float32(str))\n");<br>
}<br>
<br>
<br>
For reference:<br>
<div class="im"><a href="http://www.ros.org/wiki/Windows" target="_blank">http://www.ros.org/wiki/Windows</a><br>
</div><a href="http://docs.python.org/extending/index.html" target="_blank">http://docs.python.org/extending/index.html</a><br>
<a href="http://www.boost.org/doc/libs/1_42_0/libs/python/doc/index.html" target="_blank">http://www.boost.org/doc/libs/1_42_0/libs/python/doc/index.html</a><br>
<br>
<br>
Aaron Solochek さんは書きました:<br>
<div><div></div><div class="h5">> Yeah, I've read that.  It addresses getting ROS running on windows,<br>
> which is not what I want to do.  I don't need a complete ROS environment<br>
> on windows.  All I need is to communicate with a ROS network.<br>
><br>
> My question is whether it will be fairly straight forward to emulate a a<br>
> very simple ROS node on windows (capable of sending joystick commands),<br>
> or if that will be complicated enough that I'm better off doing<br>
> something proprietary for the windows<->ROS communication link.<br>
><br>
> To be clear, I'm talking about trying to implement the bare minimum<br>
> required to appear as a ROS node to roscore (running on another machine)<br>
> from scratch in C#.<br>
><br>
> -Aaron<br>
><br>
><br>
><br>
> On 6/14/2010 5:18 PM, Ken Conley wrote:<br>
>> This wiki page has all the currently known ways of getting running on<br>
>> Windows:<br>
>><br>
>> <a href="http://www.ros.org/wiki/Windows" target="_blank">http://www.ros.org/wiki/Windows</a><br>
>><br>
>>  - Ken<br>
>><br>
>> On Mon, Jun 14, 2010 at 11:18 AM, Aaron Solochek<br>
>> <<a href="mailto:aarons-ros@aberrant.org">aarons-ros@aberrant.org</a> <mailto:<a href="mailto:aarons-ros@aberrant.org">aarons-ros@aberrant.org</a>>> wrote:<br>
>><br>
>>     The system I'm working on uses ROS on the backend for a variety of<br>
>>     control stuff, but has a user interface that is going to be written<br>
>>     in C#.<br>
>><br>
>>     What is the recommended way to get some 2-way communication going<br>
>>     between this windows program and ROS?  Should I make a node on the linux<br>
>>     box that speaks some proprietary thing with the windows program, or<br>
>>     should I try to implement a ROS node in C#?<br>
>><br>
>>     Better yet, has anyone already done something I can use for this? :)<br>
>><br>
>>     Any advice would be appreciated, and please copy me on replies since I'm<br>
>>     only getting the daily digest of this list.<br>
>><br>
>>     Thanks,<br>
>><br>
>>     -Aaron<br>
>>     _______________________________________________<br>
>>     ros-users mailing list<br>
>>     <a href="mailto:ros-users@code.ros.org">ros-users@code.ros.org</a> <mailto:<a href="mailto:ros-users@code.ros.org">ros-users@code.ros.org</a>><br>
>>     <a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/listinfo/ros-users</a><br>
>><br>
>><br>
>> !DSPAM:4c169cd0309315323969998!<br>
><br>
> _______________________________________________<br>
> ros-users mailing list<br>
> <a href="mailto:ros-users@code.ros.org">ros-users@code.ros.org</a><br>
> <a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/listinfo/ros-users</a><br>
><br>
<br>
_______________________________________________<br>
ros-users mailing list<br>
<a href="mailto:ros-users@code.ros.org">ros-users@code.ros.org</a><br>
<a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/listinfo/ros-users</a><br>
</div></div></blockquote></div><br>