示例#1
0
            string _serial_number;                          // The best approximation of the battery serial number

            public BatteryStateMsg(JSONNode msg)
            {
                _header                  = new std_msgs.HeaderMsg(msg["header"]);
                _voltage                 = msg["voltage"].AsFloat;
                _current                 = msg["current"].AsFloat;
                _charge                  = msg["charge"].AsFloat;
                _capacity                = msg["capacity"].AsFloat;
                _design_capacity         = msg["design_capacity"].AsFloat;
                _percentage              = msg["percentage"].AsFloat;
                _power_supply_status     = (PowerSupplyStatus)msg["power_supply_status"].AsInt;
                _power_supply_health     = (PowerSupplyHealth)msg["power_supply_health"].AsInt;
                _power_supply_technology = (PowerSupplyTechnology)msg["power_supply_technology"].AsInt;
                _present                 = msg["present"].AsBool;

                JSONArray cell_voltages_temp = msg["cell_voltage"].AsArray;

                _cell_voltage = new float[cell_voltages_temp.Count];
                for (int i = 0; i < _cell_voltage.Length; i++)
                {
                    _cell_voltage[i] = cell_voltages_temp[i].AsFloat;
                }

                _location      = msg["location"].Value;
                _serial_number = msg["serial_number"].Value;
            }
示例#2
0
            double[] _linear_velocity_covariance;    // Row major x, y, z

            public IMUMsg(JSONNode msg)
            {
                _header              = new std_msgs.HeaderMsg(msg["header"]);
                _orientation         = new geometry_msgs.QuaternionMsg(msg["orientation"]);
                _angular_velocity    = new geometry_msgs.Vector3Msg(msg["angular_velocity"]);
                _linear_acceleration = new geometry_msgs.Vector3Msg(msg["linear_acceleration"]);

                JSONArray temp = msg["orientation_covariance"].AsArray;

                _orientation_covariance = new double[temp.Count];
                for (int i = 0; i < _orientation_covariance.Length; i++)
                {
                    _orientation_covariance[i] = temp[i].AsDouble;
                }

                temp = msg["angular_velocity_covariance"].AsArray;
                _angular_velocity_covariance = new double[temp.Count];
                for (int i = 0; i < _angular_velocity_covariance.Length; i++)
                {
                    _angular_velocity_covariance[i] = temp[i].AsDouble;
                }

                temp = msg["linear_acceleration_covariance"].AsArray;
                _linear_velocity_covariance = new double[temp.Count];
                for (int i = 0; i < _linear_velocity_covariance.Length; i++)
                {
                    _linear_velocity_covariance[i] = temp[i].AsDouble;
                }
            }
            public PCFaceMsg(JSONNode msg)
            {
                _header = new std_msgs.HeaderMsg(msg["header"]);
                JSONArray temp = msg["vert_x"].AsArray;

                Vert_x = new float[temp.Count];
                for (int i = 0; i < Vert_x.Length; i++)
                {
                    Vert_x[i] = temp[i].AsFloat;
                }

                temp   = msg["vert_y"].AsArray;
                Vert_y = new float[temp.Count];
                for (int i = 0; i < Vert_y.Length; i++)
                {
                    Vert_y[i] = temp[i].AsFloat;
                }
                temp   = msg["vert_z"].AsArray;
                Vert_z = new float[temp.Count];
                for (int i = 0; i < Vert_z.Length; i++)
                {
                    Vert_z[i] = temp[i].AsFloat;
                }
                String tempColor = msg["color_r"].Value;

                Color_r   = Convert.FromBase64String(tempColor);
                tempColor = msg["color_b"].Value;
                Color_b   = Convert.FromBase64String(tempColor);
                tempColor = msg["color_g"].Value;
                Color_g   = Convert.FromBase64String(tempColor);
                tempColor = msg["color_a"].Value;
                Color_a   = Convert.FromBase64String(tempColor);

                temp   = msg["face_0"].AsArray;
                Face_0 = new UInt16[temp.Count];
                for (int i = 0; i < Face_0.Length; i++)
                {
                    Face_0[i] = (UInt16)temp[i].AsInt;
                }
                temp   = msg["face_1"].AsArray;
                Face_1 = new UInt16[temp.Count];
                for (int i = 0; i < Face_1.Length; i++)
                {
                    Face_1[i] = (UInt16)temp[i].AsInt;
                }
                temp   = msg["face_2"].AsArray;
                Face_2 = new UInt16[temp.Count];
                for (int i = 0; i < Face_2.Length; i++)
                {
                    Face_2[i] = (UInt16)temp[i].AsInt;
                }
            }
            //our changes:

            public NavSatFixMsg(double lat, double lng, double alt)
            {
                _header  = new std_msgs.HeaderMsg(0, new std_msgs.TimeMsg(0, 0), "hello");
                _status  = (NavSatStatus)(-2);
                _service = (NavSatService)0;

                _latitude  = lat;
                _longitude = lng;
                _altitude  = alt;


                //JSONArray temp_covar_array = new JSONArray();
                _position_covariance      = new double[1];
                _position_covariance_type = (PositionCovarianceType)(-1);
            }
示例#5
0
            public NavSatFixMsg(JSONNode msg)
            {
                _header    = new std_msgs.HeaderMsg(msg["header"]);
                _status    = (NavSatStatus)msg["status"]["status"].AsInt;
                _service   = (NavSatService)msg["status"]["service"].AsInt;
                _latitude  = msg["latitude"].AsFloat;
                _longitude = msg["longitude"].AsFloat;
                _altitude  = msg["altitude"].AsFloat;

                JSONArray temp_covar_array = msg["position_covariance"].AsArray;

                _position_covariance = new double[temp_covar_array.Count];
                for (int i = 0; i < _position_covariance.Length; i++)
                {
                    _position_covariance[i] = temp_covar_array[i].AsDouble;
                }

                _position_covariance_type = (PositionCovarianceType)msg["position_covariance_type"].AsInt;
            }
示例#6
0
            public JoyMsg(JSONNode msg)
            {
                _header = new std_msgs.HeaderMsg(msg["header"]);

                JSONArray temp = msg["axes"].AsArray;

                _axes = new float[temp.Count];
                for (int i = 0; i < _axes.Length; i++)
                {
                    _axes[i] = temp[i].AsFloat;
                }

                temp     = msg["buttons"].AsArray;
                _buttons = new int[temp.Count];
                for (int i = 0; i < _buttons.Length; i++)
                {
                    _buttons[i] = temp[i].AsInt;
                }
            }
            public MeshMsg(JSONNode msg)
            {
                DateTime startTime = DateTime.Now;
                DateTime stageTime = startTime;

                _header = new std_msgs.HeaderMsg(msg["header"]);
//                Debug.Log("Header Generation: " + DateTime.Now.Subtract(stageTime).TotalMilliseconds.ToString() + "ms");
                stageTime          = DateTime.Now;
                _block_edge_length = float.Parse(msg["block_edge_length"]);
//                Debug.Log("Block Edge Length Generation: " + DateTime.Now.Subtract(stageTime).TotalMilliseconds.ToString() + "ms");
                stageTime = DateTime.Now;
                JSONArray temp = msg["mesh_blocks"].AsArray;

//                Debug.Log("Mesh Block Array Generation: " + DateTime.Now.Subtract(stageTime).TotalMilliseconds.ToString() + "ms");
                stageTime    = DateTime.Now;
                _mesh_blocks = new voxblox_msgs.MeshBlockMsg[temp.Count];
                for (int i = 0; i < _mesh_blocks.Length; i++)
                {
                    _mesh_blocks[i] = new voxblox_msgs.MeshBlockMsg(temp[i]);
                }
                Debug.Log("Mesh Block Generation Total: " + DateTime.Now.Subtract(stageTime).TotalMilliseconds.ToString() + "ms");
                Debug.Log("Mesh Block Generation Average: " + (DateTime.Now.Subtract(stageTime).TotalMilliseconds / _mesh_blocks.Length).ToString() + "ms");
            }
示例#8
0
 public JoyMsg(std_msgs.HeaderMsg header, float[] axes, int[] buttons)
 {
     _header  = header;
     _axes    = axes;
     _buttons = buttons;
 }