Пример #1
0
        /// <summary>
        /// This method does the initilisation of the ros client lib
        /// <remarks>Call this method before you do any other calls to ros
        /// You can specify a custom memory allocator for ros but I wouldn't recommend doing this at the moment. </remarks>
        /// </summary>
        /// <param name="args">Arguments.</param>
        /// <param name="custom_allocator">Custom allocator.</param>
        public override void Init(String[] args, rcl_allocator_t custom_allocator)
        {
            if (args == null)
            {
                throw new ArgumentNullException();
            }
            RCLReturnValues retVal = (RCLReturnValues)rcl_init(args.Length, args, custom_allocator);

            switch (retVal)
            {
            case RCLReturnValues.RCL_RET_OK:

                break;

            case RCLReturnValues.RCL_RET_ALREADY_INIT:
                throw new RCLAlreadyInitExcption();

            case RCLReturnValues.RCL_RET_BAD_ALLOC:
                throw new RCLBadAllocException();

            case RCLReturnValues.RCL_RET_ERROR:
                throw new RCLErrorException(RCLErrorHandling.Instance.GetRMWErrorState());

            default:
                break;
            }
        }
Пример #2
0
        public WaitSet(Context ctx, IList <ISubscriptionBase> subscriptions = null)
        {
            ulong numberOfSubscriptions;

            if (subscriptions == null)
            {
                numberOfSubscriptions = 0;
                subscriptions         = new List <ISubscriptionBase>();
            }
            else
            {
                numberOfSubscriptions = (ulong)subscriptions.Count;
            }

            ulong numberOfGuardConditions = 0;
            ulong numberOfTimers          = 0;
            ulong numberOfClients         = 0;
            ulong numberOfServices        = 0;
            ulong numberOfEvents          = 0;

            allocator = NativeMethods.rcutils_get_default_allocator();
            handle    = NativeMethods.rcl_get_zero_initialized_wait_set();

            Utils.CheckReturnEnum(NativeMethods.rcl_wait_set_init(
                                      ref handle,
                                      numberOfSubscriptions,
                                      numberOfGuardConditions,
                                      numberOfTimers,
                                      numberOfClients,
                                      numberOfServices,
                                      numberOfEvents,
                                      ref ctx.handle,
                                      allocator));

            Clear();

            foreach (ISubscriptionBase subscription in subscriptions)
            {
                rcl_subscription_t subscription_handle = subscription.Handle;
                Utils.CheckReturnEnum(NativeMethods.rcl_wait_set_add_subscription(ref handle, ref subscription_handle, UIntPtr.Zero));
            }
        }
Пример #3
0
 public Context()
 {
     handle    = NativeMethods.rcl_get_zero_initialized_context();
     allocator = NativeMethods.rcl_get_default_allocator();
 }
Пример #4
0
 static extern int rcl_init(int argc, [In, Out] String[] argv, rcl_allocator_t allocator);
Пример #5
0
        public Clock()
        {
            rcl_allocator_t allocator = NativeMethods.rcutils_get_default_allocator();

            handle = NativeMethods.rclcs_ros_clock_create(ref allocator);
        }
Пример #6
0
		public  abstract void Init(String[] args, rcl_allocator_t custom_allocator);
Пример #7
0
		public void Init(String[] args, rcl_allocator_t custom_allocator)
		{
			Impl.Init (args, custom_allocator);
		}