public new static void CallBack(Float64Msg msg) { Debug.Log("Hello Hello,can you hear me !" + msg.GetData()); double temp1 = 8; double temp2 = 2; double temp3 = 4; double temp4 = 6; double temp5 = 5; if (msg.GetData() == temp1) { fw = 1; Debug.Log("Received"); } else if (msg.GetData() == temp2) { bw = 2; Debug.Log("Received"); } else if (msg.GetData() == temp3) { lf = 3; Debug.Log("Received"); } else if (msg.GetData() == temp4) { rf = 4; Debug.Log("Received"); } else if (msg.GetData() == temp5) { ju = 5; Debug.Log("Received"); } }
// This function should fire on each received ros message public static void CallBack(ROSBridgeMsg msg1) { Float64Msg msg = (Float64Msg)msg1; Debug.Log("Recieved Message : " + msg.GetData()); // Update ball position, or whatever player = GameObject.Find("Player"); rb = player.GetComponent <Rigidbody>(); if (msg.GetData() == 8) { rb.AddForce(new Vector3(0, 0, 500)); } if (msg.GetData() == 6) { rb.AddForce(new Vector3(500, 0, 0)); } if (msg.GetData() == 4) { rb.AddForce(new Vector3(-500, 0, 0)); } if (msg.GetData() == 2) { rb.AddForce(new Vector3(0, 0, -500)); } if (msg.GetData() == 5) { rb.AddForce(new Vector3(0, 500, 0)); } }
public VelocityMsg(HeaderMsg header, double axis_x, double axis_y, double axis_z, double yaw) { _header = header; _axis_x = new Float64Msg(axis_x); _axis_y = new Float64Msg(axis_y); _axis_z = new Float64Msg(axis_z); _yaw = new Float64Msg(yaw); }
IEnumerator SendDepth() { yield return(new WaitForEndOfFrame()); float depth = vehicle.transform.position.y; // Debug.Log(depth); var depthMessage = new Float64Msg(depth); ros.Publish(DepthPublisher.GetMessageTopic(), depthMessage); ros.Render(); }
IEnumerator SendHeading() { yield return(new WaitForEndOfFrame()); // float x = 0.00F; // float y = 0.00F; Debug.Log(vehicle.transform.localScale); float theta = vehicle.transform.rotation.eulerAngles.y; var posemsg = new Float64Msg(theta); ros.Publish(HeadingPublisher.GetMessageTopic(), posemsg); ros.Render(); }
public CommandMsg(JSONNode msg) { //Debug.Log("CommandMsg with " + msg.ToString()); _header = new HeaderMsg(msg["header"]); _command = new Int32Msg(msg["command"]); _params = new Float64Msg[msg["params"].Count]; for (int i = 0; i < _params.Length; i++) { _params[i] = new Float64Msg(msg["params"][i]); } //Debug.Log("CommandMsg done and it looks like " + this.ToString()); }
public static string ToYAMLString(Float64Msg msg) { return(msg.ToYAMLString()); }