Difference between revisions of "Calico ROS"

From IPRE Wiki
Jump to: navigation, search
Line 30: Line 30:
# cd sandbox
# cd sandbox
# roscreate-pkg ROS std_msgs rospy roscpp roscs
# roscreate-pkg ROS std_msgs rospy roscpp roscs
# Create a C# file in src/hello.cs
# Create a C# file in ROS/src/hello.cs
# Edit ROS/CMakeLists.txt
# Edit ROS/CMakeLists.txt

Revision as of 13:32, 14 October 2012

This page describes creating a ROS/Calico connection.


ROS is the Robot Operating System. Here we assume a standard ROS install.


RosCS is a ROS package which creates a connection between Mono and ROS. It takes a C# file and dynamically builds all of the needed links into a set of dynamic link libraries (DLL).

First, we need a local copy of ROS. We are using the current version of ROS (called "fuerte"):

  1. source /opt/ros/fuerte/setup.bash
  2. mkdir ~/ros
  3. rosws init ~/ros /opt/ros/fuerte
  4. source ~/ros/setup.bash
  5. roscd

Next, we need to install the package RosCS:

  1. rosws set cn-roscs-ros-pkg --git https://code.google.com/p/cn-roscs-ros-pkg/
  2. source ~/ros/setup.sh
  3. rosws update cn-roscs-ros-pkg
  4. [remove depend "mono" from ~/ros/cn-roscs-ros-pkg/roscs/manifest.xml]
  5. rosdep install roscs

Finally, we create a C# file and build the DLLs:

  1. mkdir sandbox
  2. cd sandbox
  3. roscreate-pkg ROS std_msgs rospy roscpp roscs
  4. Create a C# file in ROS/src/hello.cs
  5. Edit ROS/CMakeLists.txt


using System;
using System.Threading;
using RosCS;

public class RosCsExample
    Node node;
    Publisher pub;

    public RosCsExample()
	this.node = Node.MainNode;
	this.pub = new Publisher(this.node,"DummyTopic",RosCS.std_msgs.String.TypeId,1);

    public void OnMessage(RosCS.std_msgs.String msg) {
	Console.WriteLine("Got message: "+msg.Data);

    public void Run() {
	int i = 0;
	while(RosSharp.Ok()) {
	    RosCS.std_msgs.String msg = new RosCS.std_msgs.String();
	    msg.Data ="Hello "+i;

    public static void Main(string[] args) {                        
	RosCsExample rce = new RosCsExample();

Add to bottom of CMakeLists.txt:

rosbuild_include(roscs cncs)
CSHARP_ADD_EXE(hello src/hello.cs)