bool DownloadInfo::Parse(TiXmlNode* node, muThread_Updater* thread) { TiXmlHandle nodeHandle(node); m_thread = thread; // Read name m_updateName = ParseString(nodeHandle.FirstChild("name").ToElement()); // Read filename m_fileName = ParseString(nodeHandle.FirstChild("file").ToElement()); // Read mirrors for( node = nodeHandle.FirstChild("mirrors").FirstChild("url").ToNode(); node; node=node->NextSibling("url") ) { wxString url = ParseString(node->ToElement()); if( !url.empty() ) m_URLS.push_back(url); } // Read platform m_platform = ParsePlatform(ParseString(nodeHandle.FirstChild("platform").ToElement())); // Read type m_type = ParseType(ParseString(nodeHandle.FirstChild("type").ToElement())); // Read requirement ParseString(nodeHandle.FirstChild("requires").ToElement()).ToLong(&m_requires); // Read md5 m_md5 = ParseString(nodeHandle.FirstChild("md5").ToElement()); return IsOK(); }
int main(int argc, char **argv) { GOOGLE_PROTOBUF_VERIFY_VERSION; //Verify version of ProtoBuf package ros::init(argc, argv, "luna_gui_listener"); ros::NodeHandle nodeHandle("lunabotics"); teleoperationPublisher = nodeHandle.advertise<lunabotics::Teleoperation>(TOPIC_CMD_TELEOP, 256); pidPublisher = nodeHandle.advertise<lunabotics::PID>(TOPIC_CMD_PATH_FOLLOWING, sizeof(float)*3); autonomyPublisher = nodeHandle.advertise<std_msgs::Bool>(TOPIC_CMD_AUTONOMY, 1); controlModePublisher = nodeHandle.advertise<lunabotics::SteeringMode>(TOPIC_STEERING_MODE, 1); goalPublisher = nodeHandle.advertise<lunabotics::Goal>(TOPIC_CMD_GOAL, 1); allWheelPublisher = nodeHandle.advertise<lunabotics::AllWheelState>(TOPIC_CMD_EXPLICIT_ALL_WHEEL, sizeof(float)*8); allWheelCommonPublisher = nodeHandle.advertise<lunabotics::AllWheelCommon>(TOPIC_CMD_ALL_WHEEL, sizeof(int32_t)); mapRequestPublisher = nodeHandle.advertise<std_msgs::Empty>(TOPIC_CMD_UPDATE_MAP, 1); ICRPublisher = nodeHandle.advertise<lunabotics::ICRControl>(TOPIC_CMD_ICR, sizeof(float)*3); CrabPublisher = nodeHandle.advertise<lunabotics::CrabControl>(TOPIC_CMD_CRAB, sizeof(float)*3); connPublisher = nodeHandle.advertise<lunabotics::Connection>(TOPIC_CMD_CONN, 256); signal(SIGINT,quit); // Quits program if ctrl + c is pressed acceptor.listen(); ROS_INFO("Listening on %d", PORT); acceptor.async_accept(sock, accept_handler); io_service.run(); ros::shutdown(); return 0; }
static void mdlStart(SimStruct *S) { // Notify SFUNPRINTF("Starting Instance of %s.\n", TOSTRING(S_FUNCTION_NAME)); // init ROS if not yet done. initROS(S); ros::NodeHandle nodeHandle(ros::this_node::getName()); void** vecPWork = ssGetPWork(S); ros::Time::init(); ros::Time* firstExecTime = new ros::Time(ros::Time::now()); vecPWork[0] = firstExecTime; ros::Time* lastExecTime = new ros::Time(*firstExecTime); vecPWork[1] = lastExecTime; real_T* vecRWork = ssGetRWork(S); vecRWork[0] = mxGetScalar(ssGetSFcnParam(S, 0)); // Tsim vecRWork[1] = 0.0; // simulationTime int_T* vecIWork = ssGetIWork(S); vecIWork[0] = 1; // initialize step counter }
static void mdlStart(SimStruct *S) { SFUNPRINTF("Starting Instance of %s.\n", TOSTRING(S_FUNCTION_NAME)); // init ROS if not yet done. initROS(S); void** vecPWork = ssGetPWork(S); ros::AsyncSpinner* spinner = new ros::AsyncSpinner(1); // Spinner spinner->start(); vecPWork[0] = spinner; ros::NodeHandle nodeHandle(ros::this_node::getName()); // get String size_t buflen = mxGetN((ssGetSFcnParam(S, 1)))*sizeof(mxChar)+1; char* topic = (char*)mxMalloc(buflen); size_t status = mxGetString((ssGetSFcnParam(S, 1)), topic, buflen); //SFUNPRINTF("The string being passed as a Paramater is - %s\n ", topic); GenericSubscriber<sensor_msgs::Joy>* sub = new GenericSubscriber<sensor_msgs::Joy>(nodeHandle, std::string(topic), 100); vecPWork[1] = sub; //*sub = n.subscribe(std::string(topic), 1, msgCallback); // free char array mxFree(topic); }
static void getContextMenuFromDefaultMenu(WKBundlePageRef page, WKBundleHitTestResultRef hitTestResult, WKArrayRef defaultMenu, WKArrayRef* newMenu, WKTypeRef* userData, const void* clientInfo) { WKRetainPtr<WKBundleNodeHandleRef> nodeHandle(AdoptWK, WKBundleHitTestResultCopyNodeHandle(hitTestResult)); if (!nodeHandle) return; WKBundlePostMessage(InjectedBundleController::shared().bundle(), Util::toWK("HitTestResultNodeHandleTestDoneMessageName").get(), Util::toWK("HitTestResultNodeHandleTestDoneMessageBody").get()); }
void LayoutTestController::setValueForUser(JSContextRef context, JSValueRef element, JSStringRef value) { if (!element || !JSValueIsObject(context, element)) return; WKRetainPtr<WKBundleNodeHandleRef> nodeHandle(AdoptWK, WKBundleNodeHandleCreate(context, const_cast<JSObjectRef>(element))); WKBundleNodeHandleSetHTMLInputElementValueForUser(nodeHandle.get(), toWK(value).get()); }
int main(int argc, char** argv) { ros::init(argc, argv, "point_cloud_preprocessing"); ros::NodeHandle nodeHandle("~"); point_cloud_preprocessing::PointCloudPreprocessing PointCloudPreprocessing(nodeHandle); ros::waitForShutdown(); return 0; }
int main(int argc, char** argv) { ros::init(argc, argv, "grid_map_filters_demo"); ros::NodeHandle nodeHandle("~"); bool success; grid_map_demos::FiltersDemo filtersDemo(nodeHandle, success); if (success) ros::spin(); return 0; }
int main(int argc, char** argv) { ros::init(argc, argv, "map_fitter"); ros::NodeHandle nodeHandle("~"); map_fitter::MapFitter mapFitter(nodeHandle); ros::spin(); return 0; }
int main(int argc, char** argv) { ros::init(argc, argv, "read"); ros::NodeHandle nodeHandle("~"); point_cloud_io::Read read(nodeHandle); ros::spin(); return 0; }
int main(int argc, char** argv) { ros::init(argc, argv, "write"); ros::NodeHandle nodeHandle("~"); point_cloud_io::Write write(nodeHandle); ros::spin(); return 0; }
int main(int argc, char** argv) { ros::init(argc, argv, "grid_map_visualization"); ros::NodeHandle nodeHandle("~"); grid_map_visualization::GridMapVisualization gridMapVisualization(nodeHandle, "grid_map_visualizations"); ros::spin(); return 0; }
int main(int argc, char** argv) { ros::init(argc, argv, "lidar_to_point_cloud_transformer"); ros::NodeHandle nodeHandle("~"); lidar_to_point_cloud_transformer::LidarToPointCloudTransformer lidarToPointCloudTransformer(nodeHandle); ros::spin(); return 0; }
int main(int argc, char **argv) { ros::init(argc, argv, "image_changer"); dynamic_reconfigure::Server<imagepub_waitinglist::ImageChangerConfigConfig> srv; dynamic_reconfigure::Server<imagepub_waitinglist::ImageChangerConfigConfig>::CallbackType f; f = boost::bind(&callback, _1, _2); srv.setCallback(f); ros::NodeHandle nodeHandle("~"); nodeHandle.param("brightness",brightness,int(0)); nodeHandle.param("contrast",contrast,double(1)); image_transport::ImageTransport it(nodeHandle); image_transport::Subscriber sub = it.subscribe("/image_original", 1, imageCallback); pub = it.advertise("/image", 1); ros::spin(); }
static void mdlStart(SimStruct *S) { SFUNPRINTF("Starting Instance of %s.\n", TOSTRING(S_FUNCTION_NAME)); // init ROS if not yet done. initROS(S); void** vecPWork = ssGetPWork(S); int_T nRobots = mxGetNumberOfElements(ssGetSFcnParam(S,2)); *ssGetIWork(S) = nRobots; ssGetIWork(S)[1] = *((mxChar*)mxGetData(ssGetSFcnParam(S, 4))); ros::NodeHandle nodeHandle(ros::this_node::getName()); // get Topic Strings size_t prefix_buflen = mxGetN((ssGetSFcnParam(S, 1)))*sizeof(mxChar)+1; size_t postfix_buflen = mxGetN((ssGetSFcnParam(S, 3)))*sizeof(mxChar)+1; char* prefix_topic = (char*)mxMalloc(prefix_buflen); char* postfix_topic = (char*)mxMalloc(postfix_buflen); mxGetString((ssGetSFcnParam(S, 1)), prefix_topic, prefix_buflen); mxGetString((ssGetSFcnParam(S, 3)), postfix_topic, postfix_buflen); //SFUNPRINTF("The string being passed as a Paramater is - %s\n ", topic); std::stringstream sstream; mxChar* robotIDs = (mxChar*)mxGetData(ssGetSFcnParam(S, 2)); for (unsigned int i = 0; i < nRobots; ++i) { sstream.str(std::string()); // build topicstring sstream << prefix_topic; sstream << (uint)robotIDs[i]; sstream << postfix_topic; GenericSubscriber<sensor_msgs::JointState>* sub = new GenericSubscriber<sensor_msgs::JointState>(nodeHandle, sstream.str(), 10); vecPWork[i] = sub; } // free char array mxFree(prefix_topic); mxFree(postfix_topic); // Create nRobot Spinners ros::AsyncSpinner* spinner = new ros::AsyncSpinner(nRobots); // nRobots Spinner spinner->start(); vecPWork[nRobots] = spinner; }
int main(int argc, char **argv) { ros::init(argc, argv, "srl_nearest_neighbor_tracker"); ros::NodeHandle nodeHandle(""); ros::NodeHandle privateHandle("~"); // Set up the ROS interface, which also establishes the connection to the parameter server srl_nnt::ROSInterface rosInterface(nodeHandle, privateHandle); // Now create the tracker and connect to the ROS interface srl_nnt::NearestNeighborTracker tracker(nodeHandle, privateHandle); rosInterface.connect(&tracker); rosInterface.spin(); }
int main(int argc, char **argv) { ros::init(argc, argv, "harris_corners"); dynamic_reconfigure::Server<harris_waitinglist::HarrisConfig> srv; dynamic_reconfigure::Server<harris_waitinglist::HarrisConfig>::CallbackType f; f = boost::bind(&callback, _1, _2); srv.setCallback(f); ros::NodeHandle nodeHandle("~"); nodeHandle.param("template_size",templateSize,int(3)); nodeHandle.param("threshold",threshold,double(0.1)); cvNamedWindow("Harris Corner Detection"); cvStartWindowThread(); image_transport::ImageTransport it(nodeHandle); image_transport::Subscriber sub = it.subscribe("/image_original", 1, imageCallback); ros::spin(); cvDestroyWindow("Harris Corner Detection"); }
/* Function: mdlTerminate ===================================================== * Abstract: * In this function, you should perform any actions that are necessary * at the termination of a simulation. For example, if memory was * allocated in mdlStart, this is the place to free it. */ static void mdlTerminate(SimStruct *S) { // get Objects ros::NodeHandle nodeHandle(ros::this_node::getName()); void** vecPWork = ssGetPWork(S); ros::ServiceClient* start_client = (ros::ServiceClient*)vecPWork[0]; delete start_client; ros::ServiceClient* stop_client = (ros::ServiceClient*)vecPWork[1]; vrep_common::simRosStopSimulation stopSrv; stop_client->call(stopSrv); if (stopSrv.response.result == -1){ ssWarning(S,"Error stopping V-REP simulation."); } delete stop_client; ros::ServiceClient* synchronous_client = (ros::ServiceClient*)vecPWork[2]; vrep_common::simRosSynchronous syncSrv; syncSrv.request.enable = false; synchronous_client->call(syncSrv); if (syncSrv.response.result == -1){ ssWarning(S,"Error setting V-REP synchronous simulation mode."); } delete synchronous_client; ros::ServiceClient* trigger_client = (ros::ServiceClient*)vecPWork[3]; delete trigger_client; // delete all subscribers and spinners const int_T nWaitTopic = ssGetIWork(S)[0]; for (int_T i = 0; i<nWaitTopic; ++i){ GenericSubscriber<topic_tools::ShapeShifter>* sub = (GenericSubscriber<topic_tools::ShapeShifter>*) vecPWork[4+i]; delete sub; } if (nWaitTopic>0){ ros::AsyncSpinner* spinner = (ros::AsyncSpinner*) vecPWork[4+nWaitTopic]; delete spinner; } SFUNPRINTF("Terminating Instance of %s.\n", TOSTRING(S_FUNCTION_NAME)); }
int main(int argc, char** argv) { ros::init(argc, argv, "baxter_eyes_node"); ros::NodeHandle nodeHandle("~"); if(argc < 3){ std::cout << std::endl; std::cout << "Not enough arguments provided." << std::endl; std::cout << "Usage: <eye_contour image file> <pupil image file>" << std::endl; return 0; } baxter_eyes::BaxterEyes BaxterEyes(nodeHandle, std::string(argv[1]), std::string(argv[2])); ros::spin(); return 0; };
int main(int argc, char **argv) { ros::init(argc, argv, "luna_fear"); ros::NodeHandle nodeHandle("lunabotics"); ros::Subscriber visionSubscriber = nodeHandle.subscribe(TOPIC_TM_VISION, 256, visionCallback); ros::Subscriber stateSubscriber = nodeHandle.subscribe(TOPIC_TM_ROBOT_STATE, 256, stateCallback); ros::Publisher emergencyPublisher = nodeHandle.advertise<lunabotics::Emergency>(TOPIC_EMERGENCY, 256); ros::Rate loop_rate(50); ROS_INFO("Emergency behavior ready"); while (ros::ok()) { emergencyPublisher.publish(emergencyMsg); ros::spinOnce(); loop_rate.sleep(); } return 0; }
static void mdlStart(SimStruct *S) { SFUNPRINTF("Starting Instance of %s.\n", TOSTRING(S_FUNCTION_NAME)); // init ROS if not yet done. initROS(S); void** vecPWork = ssGetPWork(S); // save nRobots in IWorkVector int_T nRobots = mxGetNumberOfElements(ssGetSFcnParam(S,2)); *ssGetIWork(S) = nRobots; ros::NodeHandle nodeHandle(ros::this_node::getName()); // get Topic Strings size_t prefix_buflen = mxGetN((ssGetSFcnParam(S, 1)))*sizeof(mxChar)+1; size_t postfix_buflen = mxGetN((ssGetSFcnParam(S, 3)))*sizeof(mxChar)+1; char* prefix_topic = (char*)mxMalloc(prefix_buflen); char* postfix_topic = (char*)mxMalloc(postfix_buflen); mxGetString((ssGetSFcnParam(S, 1)), prefix_topic, prefix_buflen); mxGetString((ssGetSFcnParam(S, 3)), postfix_topic, postfix_buflen); //SFUNPRINTF("The string being passed as a Paramater is - %s\n ", topic); std::stringstream sstream; mxChar* robotIDs = (mxChar*)mxGetData(ssGetSFcnParam(S, 2)); for (unsigned int i = 0; i < nRobots; ++i) { sstream.str(std::string()); // build topicstring sstream << prefix_topic; sstream << (uint)robotIDs[i]; sstream << postfix_topic; GenericPublisher<geometry_msgs::PointStamped>* pub = new GenericPublisher<geometry_msgs::PointStamped>(nodeHandle, sstream.str(), 10); vecPWork[i] = pub; } // free char array mxFree(prefix_topic); mxFree(postfix_topic); }
int main(int argc, char** argv) { ros::init(argc, argv, "ur3_milling"); ros::NodeHandle nodeHandle("~"); ur3_milling::MillingPath milling_path(nodeHandle); ros::AsyncSpinner spinner(2); spinner.start(); ros::Rate loop_rate(1000); while (ros::ok()) { ros::spinOnce(); loop_rate.sleep(); } ros::waitForShutdown(); return 0; }
int main(int argc, char** argv) { ros::init(argc, argv, "file_publisher"); ros::NodeHandle nodeHandle("~"); image_transport::ImageTransport it(nodeHandle); image_transport::Publisher pub = it.advertise("/image_original", 1); nodeHandle.param("file",file,std::string("unknown")); nodeHandle.param("frequency",frequency,int(5)); cv::WImageBuffer3_b image(cvLoadImage(file.c_str(),CV_LOAD_IMAGE_COLOR)); sensor_msgs::ImagePtr msg = sensor_msgs::CvBridge::cvToImgMsg(image.Ipl(),"bgr8"); ros::Rate loop_rate(0.5); // while (nodeHandle.ok()) { loop_rate.sleep(); pub.publish(msg); ros::spinOnce(); loop_rate.sleep(); pub.publish(msg); ros::spinOnce(); // } }
static void mdlStart(SimStruct *S) { SFUNPRINTF("Creating Instance of %s.\n", TOSTRING(S_FUNCTION_NAME)); // init ROS if not yet done. initROS(S); void** vecPWork = ssGetPWork(S); ros::NodeHandle nodeHandle(ros::this_node::getName()); // get Topic Strings size_t buflen = mxGetN((ssGetSFcnParam(S, 1))) * sizeof(mxChar) + 1; char* topic = (char*) mxMalloc(buflen); mxGetString((ssGetSFcnParam(S, 1)), topic, buflen); //SFUNPRINTF("The string being passed as a Paramater is - %s\n ", topic); GenericPublisher<shape_msgs::Mesh>* pub = new GenericPublisher< shape_msgs::Mesh>(nodeHandle, topic, 10); vecPWork[0] = pub; mxFree(topic); }
static void mdlStart(SimStruct *S) { SFUNPRINTF("Starting Instance of %s.\n", TOSTRING(S_FUNCTION_NAME)); // init ROS if not yet done. initROS(S); void** vecPWork = ssGetPWork(S); ros::NodeHandle nodeHandle(ros::this_node::getName()); // get base service name strings size_t buflen = mxGetN((ssGetSFcnParam(S, 1)))*sizeof(mxChar)+1; char* base_name = (char*)mxMalloc(buflen); mxGetString((ssGetSFcnParam(S, 1)), base_name, buflen); const std::string start_name = std::string(base_name) + "/simRosStartSimulation"; ros::ServiceClient* start_client = new ros::ServiceClient(nodeHandle.serviceClient<vrep_common::simRosStartSimulation>(start_name)); vecPWork[0] = start_client; if (!start_client->exists()){ ssSetErrorStatus(S,"Start service does not exist!"); } const std::string stop_name = std::string(base_name) + "/simRosStopSimulation"; ros::ServiceClient* stop_client = new ros::ServiceClient(nodeHandle.serviceClient<vrep_common::simRosStopSimulation>(stop_name)); vecPWork[1] = stop_client; if (!stop_client->exists()){ ssSetErrorStatus(S,"Stop service does not exist!"); } const std::string synchronous_name = std::string(base_name) + "/simRosSynchronous"; ros::ServiceClient* synchronous_client = new ros::ServiceClient(nodeHandle.serviceClient<vrep_common::simRosSynchronous>(synchronous_name)); vecPWork[2] = synchronous_client; if (!synchronous_client->exists()){ ssSetErrorStatus(S,"Synchronous service does not exist!"); } const std::string trigger_name = std::string(base_name) + "/simRosSynchronousTrigger"; ros::ServiceClient* trigger_client = new ros::ServiceClient(nodeHandle.serviceClient<vrep_common::simRosSynchronousTrigger>(trigger_name)); vecPWork[3] = trigger_client; if (!trigger_client->exists()){ ssSetErrorStatus(S,"Trigger service does not exist!"); } const std::string info_name = std::string(base_name) + "/simRosGetInfo"; ros::ServiceClient* info_client = new ros::ServiceClient(nodeHandle.serviceClient<vrep_common::simRosGetInfo>(info_name)); if (!info_client->exists()){ ssSetErrorStatus(S,"Info service does not exist!"); } const std::string parameter_name = std::string(base_name) + "/simRosSetFloatingParameter"; ros::ServiceClient* parameter_client = new ros::ServiceClient(nodeHandle.serviceClient<vrep_common::simRosSetFloatingParameter>(parameter_name)); if (!parameter_client->exists()){ ssSetErrorStatus(S,"Set parameter service does not exist!"); } mxFree(base_name); // Set V-Rep time step to this block time step const real_T tSim = mxGetScalar(ssGetSFcnParam(S, 0)); vrep_common::simRosSetFloatingParameter paramSrv; paramSrv.request.parameter = sim_floatparam_simulation_time_step; paramSrv.request.parameterValue = tSim; parameter_client->call(paramSrv); if (paramSrv.response.result == -1){ ssSetErrorStatus(S,"Error setting V-REP simulation time step."); } vrep_common::simRosGetInfo infoSrv; info_client->call(infoSrv); const real_T vrepTimeStep = ROUND(infoSrv.response.timeStep*1e6)*1e-6; if (fabs(vrepTimeStep-tSim) > 1e-5){ char str[100]; sprintf(str, "V-REP time step (%e) is different from block time step (%e).", vrepTimeStep, tSim); ssSetErrorStatus(S,str); } // Set synchronous mode vrep_common::simRosSynchronous syncSrv; syncSrv.request.enable = true; synchronous_client->call(syncSrv); if (syncSrv.response.result == -1){ ssSetErrorStatus(S,"Error setting V-REP synchronous simulation mode."); } // Start V-Rep simulation vrep_common::simRosStartSimulation startSrv; start_client->call(startSrv); if (startSrv.response.result == -1){ ssSetErrorStatus(S,"Error starting V-REP simulation."); } // Subscribe to all the topics to wait size_t wait_buflen = mxGetN((ssGetSFcnParam(S, 2)))*sizeof(mxChar)+1; char* wait_name = (char*)mxMalloc(wait_buflen); mxGetString((ssGetSFcnParam(S, 2)), wait_name, wait_buflen); int_T nWaitTopic = 0; char* topic = strtok(wait_name, TOPIC_SEPARATORS); while(topic != NULL){ GenericSubscriber<topic_tools::ShapeShifter>* sub = new GenericSubscriber<topic_tools::ShapeShifter>(nodeHandle, topic, 1); vecPWork[4+nWaitTopic] = sub; nWaitTopic++; topic = strtok (NULL, TOPIC_SEPARATORS); } if (nWaitTopic>0){ ros::AsyncSpinner* spinner = new ros::AsyncSpinner(nWaitTopic); spinner->start(); vecPWork[4+nWaitTopic] = spinner; ssGetIWork(S)[0] = nWaitTopic; } mxFree(wait_name); }