void initConfig() { robotConfigs = new RobotConfig[num_RosConnectors]; for (int i = 0; i < num_RosConnectors; i++) { // initiate the robotConfigs for all available rosconnectors robotConfigs[i] = new RobotConfig(); Debug.Log("new RobotConfig generated"); robotConfigs[i].rosMode = 0; robotConfigs[i].poseMode = 0; robotConfigs[i].isManualPose = false; robotConfigs[i].isIterativeMode = false; robotConfigs[i].isPoseMode = false; robotConfigs[i].poseInterval = 10f; //robotConfigs[i].robotName = GameObject.Find("RosConnectors").transform.GetChild(i).name; robotConfigs[i].robotName = GameObject.Find("RosConnectors").transform.GetChild(i).name; Debug.Log(GameObject.Find("RosConnectors").transform.GetChild(i).name); Debug.Log(robotConfigs[i].robotName); } // get the reference for each rosconnector for (int i = 0; i < num_RosConnectors; i++) { rosConnectors[i] = GameObject.Find("RosConnectors").transform.GetChild(i).gameObject; } RobotChanged(0); }
void initDropdown() { for (int i = 0; i < num_RosConnectors; i++) { robotConfigs[i] = new RobotConfig(); robotConfigs[i].rosMode = 0; robotConfigs[i].poseMode = 0; robotConfigs[i].isManualPose = false; robotConfigs[i].isIterativeMode = false; robotConfigs[i].isPoseMode = false; robotConfigs[i].poseInterval = 10f; } for (int i = 0; i < num_RosConnectors; i++) { rosConnectors[i] = GameObject.Find("RosConnectors").transform.GetChild(i).gameObject; } robotDropdown.ClearOptions(); foreach (GameObject g in rosConnectors) { robotDropdown.options.Add(new Dropdown.OptionData() { text = g.name }); } robotDropdown.value = 0; RobotDropdownValueChanged(robotDropdown); }