Jump to content

component in CIGI


photo

Recommended Posts

Are all CiGi classes related to CigiHostPacket automatically processed upon receive?

I think ComponentControl will be handled differently depending on the data and functions.

For example, what should I do when I want to use LandingGears and LandingGearPart of be_200?

 

Or are the things described in the "Setting up properties" tab of Ig documents irrelevant with  ComponentControl ?

 

Simply put, I don't understand exactly the mechanism between component elements in the ig_config and setting properties in the nodereference for Entity.

Can I ask you to elaborate on that?

Edited by dongju.jeong
Link to comment
Quote

Are all CiGi classes related to CigiHostPacket automatically processed upon receive?

no, not all. list of supported packets.

Quote

I think ComponentControl will be handled differently depending on the data and functions.

components work flow:

When the component control packet arrives, IG search component by ID in ig_config.xml. Next, IG search Component with name in <property>. By parameter "state"/"data1"/"data2" in packet IG search corresponding parameter in component (landing/taxi/navigation) and transmit value into component parameter. Сomponent itself decides what to do with the new value.

for example:
ComponentControl packet received: component_id = 0, instance_id = 0, component_class = 0, component_data_1 = 1.

1. instance_id = 0, component_class = 0 means what packet for entity 0.
2. supposably entity 0 has type 200. In ig_config.xml, for 200 type and component_id = 0 IG gets component LightAircraftController, and for component_data_1 take in LightAircraftController parameter "landing"
3. IG transmit value component_data_1 into parameter "landing" (type of value does not matter).

Quote

For example, what should I do when I want to use LandingGears and LandingGearPart of be_200?

LandingGearPart - it`s part of LandingGears component. It does not work separately.
To control the LandingGears, you need to configure the NodeReference. Then you need to specify in the ig_config.xml which host parameters in which IG parameters to transfer. 
(for testing in HEMU with current configurate be-200 you can use Entities.def in attach)

I think, We need to write detailed instructions for creating your own components in the documentation.

Entities.def

  • Like 1
Link to comment

It is great helpful for me. thank you.

I see that properties related to component in Ig template works automatically when recieve component packet.

 

but, if I make custom property and write custom component element in ig_config, Do I need register callback function in "setReceivePacketCallback" for desired work?

 

+ I want to know how use EntityCameras.prop and EntityComponent.prop in Ig/properties folder.

Edited by dongju.jeong
Link to comment
Quote

but, if I make custom property and write custom component element in ig_config, Do I need register callback function in "setReceivePacketCallback" for desired work?

No, additional processing is not necessary.


advice: you could add callback inside component to know when the values have changed.

void YouCustomComponent::init()
{
	getProperty()->addCallback(Property::CALLBACK_PARAMETER_CHANGED, MakeCallback(this,&YouCustomComponent::parameter_changed));
}

//method will call, when property changed
void YouCustomComponent::parameter_changed(PropertyPtr property, int num)
{
	//TODO smth 
}


 

Quote

+ I want to know how use EntityCameras.prop and EntityComponent.prop in Ig/properties folder.

its internal property, no useful payload in current realease

  • Like 1
Link to comment
On 2/28/2019 at 5:17 PM, cash-metall said:

No, additional processing is not necessary.

Do these properties(such as landingGears, landingGearsPart etc) also mean that the callback function is set somewhere?

On 2/28/2019 at 5:17 PM, cash-metall said:

getProperty()->addCallback(Property::CALLBACK_PARAMETER_CHANGED, MakeCallback(this,&YouCustomComponent::parameter_changed));

 

[+ I was just wondering where is the code that actually rotate the node corresponding to the landingGearPart.

Because when I created the new property related to custom component, I  want to imitate that way.

Just because the property parameter changes, it is unlikely that action will occur automatically.]

 

Edited by dongju.jeong
Link to comment

If I have set the callback function for a change in one parameter, is there a problem when the changed value of the other parameter also has to be considered?
(For example, when a component packet changes all parameters in the property,
If the callback function is executed first before the value of the other parameters that must be considered is changed,

the function seems unlikely to be implemented as I intended.)

Edited by dongju.jeong
Link to comment
×
×
  • Create New...