We need to write a ThrusterModel class that will contain:
Thruster Name
Power -> Force lookup table
Transform from center of mass to thruster
At launch, (in the spinFirst method) the physics simulator will read the model/thrusters/names param, which contains a list of the thrusters to be simulated. For each thruster, make a new ThrusterModel class instance then attempt to find find the model/thrusters/ param and use model/thrusters//power and model/thrusters//force to populate the lookup table. It will then use tf to lookup a transform called link. If it can perform both of these operations successfully, the new ThrusterModel will be added to a deque of ThrusterModels called thrusters.
The node will also subscribe the topic on which motor values are published at this time. When it receives a motor callback it will do the following for each thruster:
Lookup force output for the given power value in the motor value message
Cross this force with the thruster's transform, resulting in the wrench (torque + linear force) on the sub's center of mass due to the force.
Add this wrench to another data member wrench called current_thrusterforce, which will describe the net wrench due to all thrusters.
Thruster forces will be cached until the next time a motor value message is received. The assumption is that the thruster forces will be constant between motor value callbacks.
At each simulation timestep, the current_thrusterforce wrench will be used to generate the total wrench experienced at the center of mass.
We need to write a ThrusterModel class that will contain:
At launch, (in the spinFirst method) the physics simulator will read the model/thrusters/names param, which contains a list of the thrusters to be simulated. For each thruster, make a new ThrusterModel class instance then attempt to find find the model/thrusters/ param and use model/thrusters//power and model/thrusters//force to populate the lookup table. It will then use tf to lookup a transform called link. If it can perform both of these operations successfully, the new ThrusterModel will be added to a deque of ThrusterModels called thrusters.
The node will also subscribe the topic on which motor values are published at this time. When it receives a motor callback it will do the following for each thruster:
Thruster forces will be cached until the next time a motor value message is received. The assumption is that the thruster forces will be constant between motor value callbacks.
At each simulation timestep, the current_thrusterforce wrench will be used to generate the total wrench experienced at the center of mass.