public MarkersVisual(string topic) { ROSConnection ros = ROSConnection.GetOrCreateInstance(); RosTopicState state = ros.GetTopic(topic); if (state.RosMessageName == MarkerArrayMsg.k_RosMessageName) { ros.Subscribe <MarkerArrayMsg>(topic, OnMarkerArray); } else if (state.RosMessageName == MarkerMsg.k_RosMessageName) { ros.Subscribe <MarkerMsg>(topic, OnMarker); } }
/// <summary> /// Initialize the component by fetching all expected joints and starting to publish to ROS /// </summary> void Start() { // Get ROS connection static instance ros = ROSConnection.instance; // Get the root of the joint tree ArticulationBody root = jointGroup.GetComponent <ArticulationBody>(); // Iteratively find all articulate bodies until we find the end effector int c = 0; while (root) { jointArticulationBodies.Add(root); var name = root.GetComponent <RosSharp.Urdf.UrdfJoint>().jointName; jointPositionIndex.Add(name, c); var next_joints = root.transform.GetComponentsInChildren <ArticulationBody>(). Where(t => t.gameObject != root.gameObject); // No more joints if (next_joints.Count() == 0) { break; } root = next_joints.First(); c += 1; } // Continuously publish the joint configuration of the robot InvokeRepeating("PublishJointStates", 1.0f, jointPublishRate); // Subscribe to the moveit trajectory topic ros.Subscribe <RosMessageTypes.Trajectory.JointTrajectory> (moveItMoveGroupRoot + moveItMoveGroup, TrajectoryHandler); }
void Start() { ros.Subscribe <RobotMoveActionGoal>(rosRobotCommandsTopicName, ExecuteRobotCommands); }
void Start() { // Get ROS connection static instance m_Ros = ROSConnection.GetOrCreateInstance(); m_Ros.Subscribe <RobotMoveActionGoal>(rosRobotCommandsTopicName, ExecuteRobotCommands); }
protected override void OnCreate() { ros = Object.FindObjectOfType <ROSConnection>(); ros.Subscribe <RobotWheelSpeed>(topicName, UpdateWheelSpeed); }
void Start() { ros.Subscribe <RosMessageTypes.Simulation.Robot>(topicName, SpawnRobot); }
void Start() { ros.Subscribe <RosColor>("color", ColorChange); }