Skip to content

Comments

feat(lcmt_generators) : Add standard LCM generators for C3 Output and Contact Descriptions#10

Open
Meow404 wants to merge 17 commits intomainfrom
stephen/dairlib-plate-balancing-example
Open

feat(lcmt_generators) : Add standard LCM generators for C3 Output and Contact Descriptions#10
Meow404 wants to merge 17 commits intomainfrom
stephen/dairlib-plate-balancing-example

Conversation

@Meow404
Copy link
Collaborator

@Meow404 Meow404 commented Jun 23, 2025

Fixes : #11, #36
Support for : DAIRLab/dairlib#376

This change is Reviewable

@Meow404 Meow404 changed the base branch from main to stephen/lcs-drake-factory-leaf-system June 23, 2025 16:40
@Meow404 Meow404 linked an issue Jun 23, 2025 that may be closed by this pull request
@Meow404 Meow404 force-pushed the stephen/dairlib-plate-balancing-example branch from 57cd440 to 1bcc69c Compare June 26, 2025 01:07
@Meow404 Meow404 force-pushed the stephen/lcs-drake-factory-leaf-system branch from 3c1e562 to bbd5e25 Compare June 26, 2025 17:05
@Meow404 Meow404 force-pushed the stephen/dairlib-plate-balancing-example branch from 1bcc69c to e1f2869 Compare June 26, 2025 17:11
@xuanhien070594
Copy link
Contributor

core/configs/solve_options_default.hpp line 3 at r1 (raw file):

#pragma once
#include <string>
const std::string default_solver_options =

I'm confused about why we use yaml string here instead of normal yaml.

@xuanhien070594
Copy link
Contributor

systems/publishers/output_publisher.h line 46 at r1 (raw file):

              c3::lcmt_output* output) const;

  //  void OutputNextC3Input(const drake::systems::Context<double>& context,

Pls remove commented codes.

@xuanhien070594
Copy link
Contributor

systems/publishers/force_publisher.h line 16 at r1 (raw file):

namespace systems {
namespace publishers {
class ContactForcePublisher : public drake::systems::LeafSystem<double> {

Missing documentation

@xuanhien070594
Copy link
Contributor

systems/publishers/force_publisher.cc line 16 at r1 (raw file):

namespace systems {
namespace publishers {
ContactForcePublisher::ContactForcePublisher() {

We'll need some documentation for input ports and output ports.

@Meow404 Meow404 force-pushed the stephen/dairlib-plate-balancing-example branch from e1f2869 to 720d12b Compare June 27, 2025 21:49
@Meow404 Meow404 changed the base branch from stephen/lcs-drake-factory-leaf-system to main June 27, 2025 22:58
@Meow404 Meow404 self-assigned this Jun 29, 2025
@xuanhien070594
Copy link
Contributor

systems/publishers/output_publisher.h line 17 at r2 (raw file):

namespace publishers {
/// Converts a OutputVector object to LCM type lcmt_robot_output
class C3OutputPublisher : public drake::systems::LeafSystem<double> {

Pls add documentation.

@xuanhien070594
Copy link
Contributor

systems/publishers/force_publisher.cc line 46 at r2 (raw file):

  MatrixXd J_c = contact_info->first;
  int contact_force_start = solution->lambda_sol_.rows() - J_c.rows();
  bool using_stewart_and_trinkle_model = contact_force_start > 0;

Using the difference in dimension of lambda and number of force basis to determine the contact model is generally not a safe way. Could we store the type of contact model in the C3Solution?

@Meow404 Meow404 force-pushed the stephen/dairlib-plate-balancing-example branch from a1a373d to 80dd8e5 Compare June 30, 2025 13:48
@Meow404
Copy link
Collaborator Author

Meow404 commented Jun 30, 2025

FYI, building with different drake versions doesnt seem to be an issue so far between dairlib and c3.

Copy link
Collaborator Author

@Meow404 Meow404 left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 19 files reviewed, 6 unresolved discussions (waiting on @xuanhien070594)


systems/publishers/force_publisher.h line 16 at r1 (raw file):

Previously, xuanhien070594 (Hien Bui) wrote…

Missing documentation

Done.


systems/publishers/force_publisher.cc line 16 at r1 (raw file):

Previously, xuanhien070594 (Hien Bui) wrote…

We'll need some documentation for input ports and output ports.

Done.


systems/publishers/output_publisher.h line 46 at r1 (raw file):

Previously, xuanhien070594 (Hien Bui) wrote…

Pls remove commented codes.

Done.


systems/publishers/output_publisher.h line 17 at r2 (raw file):

Previously, xuanhien070594 (Hien Bui) wrote…

Pls add documentation.

Done.

@xuanhien070594
Copy link
Contributor

lcmtypes/lcmt_forces.lcm line 1 at r3 (raw file):

package c3;

Should the name be lcmt_contact_forces.lcm?

@Meow404 Meow404 force-pushed the stephen/dairlib-plate-balancing-example branch 3 times, most recently from cff8615 to 0ff39d9 Compare July 9, 2025 17:55
@Meow404 Meow404 marked this pull request as ready for review July 9, 2025 18:01
@Meow404 Meow404 changed the title [WIP] feat(plate-balancing) : Support plate-balancing example in dairlib feat(plate-balancing) : Support plate-balancing example in dairlib Jul 9, 2025
@Meow404 Meow404 requested a review from xuanhien070594 July 9, 2025 18:02
@Meow404 Meow404 force-pushed the stephen/dairlib-plate-balancing-example branch from 0ff39d9 to 207d6ab Compare July 10, 2025 16:18
@xuanhien070594
Copy link
Contributor

multibody/geom_geom_collider.cc line 197 at r5 (raw file):

  if (num_friction_directions < 1) {
    // Planar contact: basis is constructed from the contact and planar normals.
    return ComputePlanarForceBasis(-query_result.signed_distance_pair.nhat_BA_W,

Should we add few lines in documentation to tell the user which forces we are calculating (i.e forces that object A acts on object B or object B acts on object A)?

@xuanhien070594
Copy link
Contributor

multibody/geom_geom_collider.cc line 197 at r5 (raw file):

Previously, xuanhien070594 (Hien Bui) wrote…

Should we add few lines in documentation to tell the user which forces we are calculating (i.e forces that object A acts on object B or object B acts on object A)?

Since you're using minus sign here, it seems that we're calculating the forces that object A acting on object B.

@Meow404 Meow404 force-pushed the stephen/dairlib-plate-balancing-example branch from 24d08ee to 7f46c87 Compare January 31, 2026 21:59
@Meow404 Meow404 force-pushed the stephen/dairlib-plate-balancing-example branch from 7f46c87 to 178616e Compare February 12, 2026 14:00
@Meow404 Meow404 changed the base branch from stephen/port-c3+ to main February 16, 2026 21:57
@Meow404 Meow404 changed the title feat(plate-balancing) : Support plate-balancing example in dairlib feat(lcmt_generators) : Add standard LCM generators for C3 Output and Contact Descriptions Feb 21, 2026
@Meow404 Meow404 force-pushed the stephen/dairlib-plate-balancing-example branch from 5907d01 to f1fb486 Compare February 22, 2026 20:17
@Meow404 Meow404 linked an issue Feb 22, 2026 that may be closed by this pull request
Copy link
Collaborator Author

@Meow404 Meow404 left a comment

Choose a reason for hiding this comment

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

@Meow404 made 9 comments and resolved 2 discussions.
Reviewable status: 16 of 45 files reviewed, 9 unresolved discussions (waiting on Meow404 and xuanhien070594).


multibody/geom_geom_collider.cc line 197 at r5 (raw file):

Previously, xuanhien070594 (Hien Bui) wrote…

Since you're using minus sign here, it seems that we're calculating the forces that object A acting on object B.

Done.


multibody/lcs_factory.cc line 377 at r5 (raw file):

Previously, xuanhien070594 (Hien Bui) wrote…

Can we reuse the contact results from LCSFactory::ComputeContactJacobian? I think we might want to store a list of GeomGeomCollider inside LCSFactory class, so we can quickly get the contact result without recalculation. What do you think?

I've made the change, but maybe there's a better solution? Currently there does not seem to be much overhead (or calculations) in inotializing the geomgeomcollider.


multibody/lcs_factory.cc line 417 at r5 (raw file):

Previously, xuanhien070594 (Hien Bui) wrote…

I think it is worth to mention somewhere in the documentation of LCSFactory about how we stack the contact forces.

For example, Stewart-Trinkle currently stacks them as [slack_1, slack_2, ..., slack N, normal_1, normal_2, ..., normal_N, tangential_1_1, ..., tangential_1_4, ... tangential_N_1, ..., tangential_N_4]

Done.


systems/lcmt_generators/c3_trajectory_generator_config.h line 12 at r5 (raw file):

Previously, xuanhien070594 (Hien Bui) wrote…

Could we add some comments to clarify why do we need start and end?

My understanding is that we need those to extract a portion of state vector.

Done.


core/configs/solve_options_default.hpp line 3 at r1 (raw file):

Previously, xuanhien070594 (Hien Bui) wrote…

I'm confused about why we use yaml string here instead of normal yaml.

When importing C3, there was an issues using the relative path of a file. This was meant to be temporary until I find a better solution.


multibody/test/lcs_factory_test.cc line 185 at r5 (raw file):

Previously, xuanhien070594 (Hien Bui) wrote…

Those tests are commented out. We can remove them if they are no longer needed.

Done.


lcmtypes/lcmt_forces.lcm line 1 at r3 (raw file):

Previously, xuanhien070594 (Hien Bui) wrote…

Should the name be lcmt_contact_forces.lcm?

Done.`


systems/lcmt_generators/contact_force_generator.cc line 63 at r5 (raw file):

Previously, xuanhien070594 (Hien Bui) wrote…

I think we're not setting the force to zero right? We just ignore it.

Done.


systems/publishers/force_publisher.cc line 46 at r2 (raw file):

Previously, xuanhien070594 (Hien Bui) wrote…

Using the difference in dimension of lambda and number of force basis to determine the contact model is generally not a safe way. Could we store the type of contact model in the C3Solution?

Done.`

@Meow404 Meow404 force-pushed the stephen/dairlib-plate-balancing-example branch 2 times, most recently from 340a7bc to 194a8c9 Compare February 23, 2026 04:22
@Meow404 Meow404 marked this pull request as ready for review February 23, 2026 05:16
@Meow404 Meow404 force-pushed the stephen/dairlib-plate-balancing-example branch from 194a8c9 to 1ab4ccd Compare February 23, 2026 20:21
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.

Merge Outstanding plate-balancing C3 Pull Request Plate-balancing example

2 participants