Skip to content

Feature/app slam#233

Open
jonpg01 wants to merge 2 commits into
feature/ros2_slam_nav_intfrom
feature/APPSlam
Open

Feature/app slam#233
jonpg01 wants to merge 2 commits into
feature/ros2_slam_nav_intfrom
feature/APPSlam

Conversation

@jonpg01

@jonpg01 jonpg01 commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@jonpg01 jonpg01 requested a review from stefanvogel June 24, 2026 20:51
Comment thread lib/APPSlam/src/App.h
/**
* @file
* @brief SLAM application
* @author Gabryel Reyes <gabryelrdiaz@gmail.com>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Replace

Comment thread lib/APPSlam/src/App.cpp
/**
* @file
* @brief SLAM application
* @author Gabryel Reyes <gabryelrdiaz@gmail.com>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Replace

/**
* @file
* @brief Channel structure definition for the SerialMuxProt.
* @author Gabryel Reyes <gabryelrdiaz@gmail.com>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Replace (although file content is yet a copy)

Comment thread lib/APPSlam/src/App.h
Comment on lines +133 to +134
* Flag for setting initial data through SMP.
*/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Use clang-format (indent is wrong)

Comment thread lib/APPSlam/src/App.h
String m_tcpRxBuffer;

/** Last reconnect attempt time. */
uint32_t m_lastReconnectAttempt;

@stefanvogel stefanvogel Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

uint32_t m_lastReconnectAttemptTimeMs

Comment thread lib/APPSlam/src/App.cpp
static LogSinkPrinter gLogSinkSerial("Serial", &Serial);

/** TCP reconnect interval in milliseconds. */
static const uint32_t TCP_RECONNECT_INTERVAL = 2000U;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
static const uint32_t TCP_RECONNECT_INTERVAL = 2000U;
static const uint32_t TCP_RECONNECT_INTERVAL_MS = 2000U;

Comment thread lib/APPSlam/src/App.h
bool setupSerialMuxProtServer();

/**
* Connect to the TCP server.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What is this TCP server about? Describe either here or in the brief of class App itself.
This is needed to help understand the approach (and if it's valid).

Comment thread lib/APPSlam/src/App.h
*
* @returns true if successful, otherwise false.
*/
bool connectToServer();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would be helpful if "Server" could get a bit more detailed.

Comment thread lib/APPSlam/src/App.h
bool connectToServer();

/**
* Send a TCP packet.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

To where? Make sure that comments add value.

Comment thread lib/APPSlam/src/App.h
void sendPacket(const String& payload);

/**
* Receive TCP packets.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

From where? Make sure that comments add value. What happens with the received packets?

Comment thread lib/APPSlam/src/App.cpp
Comment on lines +320 to +325
const int newlineIndex = m_tcpRxBuffer.lastIndexOf(String("\n"));

if (newlineIndex >= 0)
{
m_tcpRxBuffer = m_tcpRxBuffer.substring(0U, static_cast<unsigned int>(newlineIndex));
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This cannot happen since you made sure that m_tcpRxBuffer += c; is only performed if not '\n'.

Comment thread lib/APPSlam/src/App.cpp
}
else
{
m_tcpRxBuffer += c;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Add some kind of bounding here, like:

if (m_tcpRxBuffer.length() >= MAX_LINE_LEN)
{
    LOG_WARNING("TCP line too long, discarding.");
    m_tcpRxBuffer = String();
}

Comment thread lib/APPSlam/src/App.cpp
if (true == m_tcpClient.connected())
{
String packet = payload + '\n';
(void)m_tcpClient.write(reinterpret_cast<const uint8_t*>(packet.c_str()), packet.length());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do not swallow the return value

Comment thread lib/APPSlam/src/App.cpp

if (DeserializationError::Ok == err)
{
if ((!doc["linear"].isNull()) && (!doc["angular"].isNull()))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Lets use constants for "linear" and "angular" here and below.

Comment thread lib/APPSlam/src/App.cpp
}
else
{
LOG_DEBUG("Velocity command sent - Linear: %d mm/s, Angular: %d mrad/s", linearCenter, angular);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No need to repeat "Linear: %d mm/s, Angular: %d mrad/s" here since the INFO logging a few lines above already made sure we got this.

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