Home > Net >  C # multithreaded project practical problem
C # multithreaded project practical problem

Time:11-11

Understanding of multithreading is limited to definition, and currently doing a robot grasping objects on the conveyor belt of PC, involve the conveyor belt movement, object position, grasping position calculation, several modules such as robot control, how to use the multithreading control several modules and orderly operation? , that is to say, how to use multithreading do get processed information, immediately calculation; The calculated results, immediately grab; A grab is completed, immediately grab the next, and, similar to this practice, and narrative is a little bit more, hope the great god grant instruction, particularly grateful!

CodePudding user response:

Personal advice directly with Ross

Than again let you use the ans says something new, mainly Ross can simulate test, a simulation environment, better than you what all not smooth by mouth and say to be practical

CodePudding user response:

ROS in the control arm grab target routine
https://blog.csdn.net/zzu_seu/article/details/91347757

CodePudding user response:

With Ros is also tell you the actual project, never a person like this every day for the so-called threads, think how great the thread,

, even Ros that project is using the message queue, pipline do isolation, rather than a day and night for the thread

CodePudding user response:

Didn't contact with ros, and then the above mentioned several modules have been completed, the use of ABB robot, simulation in Robotstudio,,, now is that I wish to put the pieces together, and if to learn ros may take more time,,, thank you very much for your precious advice!

CodePudding user response:

Don't tube thread thread, this thing you want to be bumped into a thread even if into the pit, to climb out, and here have been demonstrated countless times see hammer like "threads", 100% into the pit, and 100% would hit their hand

Such thing as the first step is to write the context, because is not what you want the thread, but "to track the execution state", to perform an action can parallel/concurrency, but the core is state instead of thread

CodePudding user response:

This is a core never Ros such systems on the thread, the core of his design is the Node Node, is the message, is a dataflow data flow, is a state machine

CodePudding user response:

refer to 6th floor wanghui0380 response:
this is Ros core never on the thread, the system is the core of his design Node Node, is the message that is dataflow data flow, is the state machine reason

Right, it is parallel

CodePudding user response:

Since is the state tracking, you need to create a state description is

Object check -- -- -- -- -- -- -- -- -- -- -- -- -- there is object to determine whether the established state -- -- -- -- -- -- -- -- if you have already established state, update the motion, location information, if the state has not been established, the newly built state and join the object queue (state - waiting to grab objects)

Robot control -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- the subscription queue object status, no asynchronous waiting queue, queue to get a, grab control (update control state to grab objects), asynchronous waiting for the results control state (success or failure)

So design result is

Public context:

Thread safe queue queue - object
The current control object

Background services:
1. Determine the object services -- -- -- -- -- -- -- -- -- -- -- -- -- to find the object, to determine the object exists, determine whether the object of the same object, object tracking object motion, update location information
2. Grab services -- -- -- -- -- -- -- -- -- -- - get an object from public queue, set to the current control objects, starting asynchronous grab tasks, waiting for the results to grab, repeat the process

CodePudding user response:

refer to the eighth floor wanghui0380 response:
since be state tracking, you need to create a state description is

Object check -- -- -- -- -- -- -- -- -- -- -- -- -- there is object to determine whether the established state -- -- -- -- -- -- -- -- if you have already established state, update the motion, location information, if the state has not been established, the newly built state and join the object queue (state - waiting to grab objects)

Robot control -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- the subscription queue object status, no asynchronous waiting queue, queue to get a, grab control (update control state to grab objects), asynchronous waiting for the results control state (success or failure)

So design result is

Public context:

Thread safe queue queue - object
The current control object

Background services:
1. Determine the object services -- -- -- -- -- -- -- -- -- -- -- -- -- to find the object, to determine the object exists, determine whether the object of the same object, object tracking object motion, update location information
2. Grab services -- -- -- -- -- -- -- -- -- -- - get an object from public queue, set to the current control objects, starting asynchronous grab tasks, waiting for the results to grab, repeat the process

Good dalai, thank you, very detailed, I'll learn, thank you (* °?=3 °)

CodePudding user response:

Although I did not do to live a machine program,
reference
get processed information, immediately calculation; The calculated results, immediately grab; A grab is completed, immediately grab the next

But look at what you said, like is synchronous, what's the use of threads necessary?

CodePudding user response:

11 references, not fat to 130 do not change the response of the name:
although I did not do to live a machine program,
reference
get processed information, immediately calculation; The calculated results, immediately grab; A grab is completed, immediately grab the next

But look at what you said, like is synchronous, what's the use of threads necessary?

Not in sync, I describe is a whole process, but the parts in the actual application are running their own work, and there was a time of coordination

CodePudding user response:

Rx may be useful to you
https://github.com/dotnet/reactive

CodePudding user response:

https://www.jianshu.com/p/328a1cc5eddc

CodePudding user response:

refer to the 13th floor of the knights templar 18 response:
Rx may be useful to you
https://github.com/dotnet/reactive
good dalai, I see, thank you,

CodePudding user response:

refer to the original poster Balla_c response:
that is to say how to do can use multithreading a processed after information, immediately calculation; The calculated results, immediately grab; A grab is completed, immediately grab the next, and, similar to this practice, and narrative is a little bit more, hope the great god grant instruction, particularly grateful!


What you write is the ordinary method calls, is divided into synchronous and asynchronous methods,.

CodePudding user response:

Synchronous method code, for example, may be written
 ResType process the received messages (receives the message packet data) 
{
Var r1=counted (data);
Var res=start fetching (result);
return res;
}


Asynchronous code could be written and 5 or 6 years ago
 void process the received messages (packet data receiving messages, Action The callback) 
{
ThreadPool. QueueUserWorkItem (h=& gt;//call the.net automatic thread pool management a task (anonymous delegate tasks)
{
Var result=counted (data);
ThreadPool. QueueUserWorkItem (k=& gt;//call the.net automatic thread pool management a task (anonymous delegate tasks)
{
Began to crawl (result, callback);//asynchronous task to complete, the callback by parameters of Action
});
});
}

And written in recent years is to write the
 async Task Process the received messages (receives the message packet data) 
{
Var result=starting await (data);//call the.net task automatically manage an asynchronous task
Return await began to crawl (result);//call the.net task automatically manage another asynchronous task
}


Now the syntax of the concise, but actually did not change the concept of asynchronous, that is to say, you order operation is A - & gt; B - & gt; C, asynchronous multi-threaded instead is to use the.net system efficient task management mechanism to invoke the B and C, range and task end range (or task) method can immediately return A and B,

CodePudding user response:

The.net framework itself is an efficient system, but also has a lot of early years of the so-called open source framework, and learning, with complex code to achieve. The net function of one or two lines of code, so this should pay attention to, must learn. Net, put energy into the bottom and the top of your own company "original" on the system design, don't waste energy into the training on common frame of time,

CodePudding user response:

nullnull
  •  Tags:  
  • C#
  • Related