Skip to content

Pr auto protocol#78

Closed
AsiiaPine wants to merge 2 commits intoRaccoonlabDev:mainfrom
AsiiaPine:pr-auto-protocol
Closed

Pr auto protocol#78
AsiiaPine wants to merge 2 commits intoRaccoonlabDev:mainfrom
AsiiaPine:pr-auto-protocol

Conversation

@AsiiaPine
Copy link
Copy Markdown
Collaborator

This PR adds auto network protocol determination

Test coverage

  • In SITL...
  • With real device...

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

@PonomarevDA PonomarevDA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, update the submodule.

Comment thread Makefile
sitl_dronecan: checks clean
mkdir -p ${BUILD_DIR}/dronecan_sitl/obj
cd ${BUILD_DIR}/dronecan_sitl/obj && cmake -DCAN_PROTOCOL=dronecan -DUSE_PLATFORM_UBUNTU=ON -G "Unix Makefiles" ../../.. && make
cd ${BUILD_DIR}/dronecan_sitl/obj && cmake -DCAN_PROTOCOL=dronecan -DCMAKE_BUILD_TYPE=DEBUG -DUSE_PLATFORM_UBUNTU=ON -G "Unix Makefiles" ../../.. && make
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ops

}

void DronecanModule::spin_once() {
if (uavcanCheckProtocol() == CanardFrameProtocol::CANARD_FRAME_CYPHAL) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider modifying ModuleManager::get_active_protocol() instead. It is better to perform protocol check once on the initialization stage rather that check it in each spin call of each module.

Comment thread docs/dronecan/README.md
| pwm4.max | PWM duration when setpoint is max (RawCommand is 8191 or Command is 1.0) |
| pwm4.def | PWM duration when setpoint is negative or there is no setpoint at all. |
| pwm.cmd_type | 0 means RawCommand, 1 means ArrayCommand, 2 is reserved for hardpoint.Command. |
| imu.mode | Bit mask to enable IMU features: </br> Bit 1 - enable RawImu publisher, </br> Bit 2 - enable vibration metric publishing to RawImu.integration_interval, </br> Bit 3 - enable FFT acceleration publishing to RawImu.accelerometer_integral, </br> Bit 4 - enable FFT acceleration publishing to RawImu.rate_gyro_integral, </br> By default 15 that mean enable all publishers |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a conflict with dronecan mini v2 and v3. This should be fixed somehow. We either should have a separated docs for each target or to include imu params to mini v2, but to keep them always disabled (min=max=def=0). But this is out of the scope of this PR.

Comment thread Src/common/module.cpp
return protocol;
}

void Module::set_protocol(Module::Protocol new_protocol) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function should not be public.

@AsiiaPine AsiiaPine closed this Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants