Exemplo n.º 1
0
        public async Task <string> walkStraightType2(double speed, double distance, double angle, double maneuverTime)
        {
            try
            {
                if (angle != 0.0f)
                {
                    angle = angleOrientation(angle);
                    var radian       = Math.PI * angle / 180;
                    var angularSpeed = radian / maneuverTime;

                    var angular = new RosSharp.RosBridgeClient.MessageTypes.Geometry.Vector3(0.0, 0.0, angularSpeed);

                    velocityPublisher.UpdateAngularVelocity(angular);
                    await Task.Delay((int)(maneuverTime * (1200 + (angularSpeed * 120))));

                    angular.z = 0.0;
                    velocityPublisher.UpdateAngularVelocity(angular);
                }
                var distanceTime = distance / speed;
                var velocity     = new RosSharp.RosBridgeClient.MessageTypes.Geometry.Vector3(speed, 0.0, 0.0);
                velocityPublisher.UpdateLinearVelocity(velocity);
                await Task.Delay((int)(distanceTime * (1200 + (speed * 120))));

                velocity.x = 0.0;
                velocityPublisher.UpdateLinearVelocity(velocity);
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return("error updating velocity");
            }

            return("success");
        }
Exemplo n.º 2
0
        public string walkCurvedType1(double linearSpeed, double angularSpeed)
        {
            try
            {
                var angular = new RosSharp.RosBridgeClient.MessageTypes.Geometry.Vector3(0.0, 0.0, angularSpeed);

                var linear = new RosSharp.RosBridgeClient.MessageTypes.Geometry.Vector3(linearSpeed, 0.0, 0.0);
                velocityPublisher.UpdateVelocity(linear, angular);
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return("error updating velocity");
            }

            return("success");
        }
Exemplo n.º 3
0
        public string walkCurvedType2(double linearSpeed, double radius, double angle)
        {
            try
            {
                var radians      = (angle * 180) / (Math.PI);
                var angularSpeed = (linearSpeed * Math.Sin(radians)) / radius;

                var angular = new RosSharp.RosBridgeClient.MessageTypes.Geometry.Vector3(0.0, 0.0, angularSpeed);

                var linear = new RosSharp.RosBridgeClient.MessageTypes.Geometry.Vector3(linearSpeed, 0.0, 0.0);
                velocityPublisher.UpdateVelocity(linear, angular);
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return("error updating velocity");
            }

            return("success");
        }