Skip to content

issue with arm manipulation #9

@Idoabergel

Description

@Idoabergel

Hi

im trying to write a simple are manipulation function using the cpp API, i have an issue with moving the arm in/out.

bool SpotRobodog::moveArmInOut(float extensionSpeed)
{
bosdyn::api::RobotCommand robotCommand;

// Create a SynchronizedCommand within the RobotCommand
auto* synchronizedCommand = robotCommand.mutable_synchronized_command();

// Set up the ArmCommand inside the SynchronizedCommand
auto* armCommand = synchronizedCommand->mutable_arm_command();

// Build the cylindrical velocity command
auto* cylindrical_velocity = armCommand->mutable_arm_velocity_command()->mutable_cylindrical_velocity();
cylindrical_velocity->mutable_linear_velocity()->set_r(extensionSpeed);   // Set radial speed (in/out)
cylindrical_velocity->mutable_linear_velocity()->set_theta(0.0);  // No angular movement
cylindrical_velocity->mutable_linear_velocity()->set_z(0.0);      // No vertical movement

// Use chrono for high-precision timing
auto now = std::chrono::system_clock::now();
auto duration = std::chrono::milliseconds(500);  // Duration of 0.5 seconds
auto future_time = now + duration;

auto secs = std::chrono::time_point_cast<std::chrono::seconds>(future_time);
auto nanos = std::chrono::duration_cast<std::chrono::nanoseconds>(future_time - secs).count();

// Set the end_time using google::protobuf::Timestamp
auto* end_time = armCommand->mutable_arm_velocity_command()->mutable_end_time();
end_time->set_seconds(secs.time_since_epoch().count());
end_time->set_nanos(nanos);

// Send the arm command and check the result
auto arm_res = sendArmCommand(robotCommand);
if (!arm_res) {
    return false;
}

return true;

}

the error im getting is:
[component_container_mt-1] [ERROR] [1726597323.348119238] [XTRA]: [SpotRobodog.cpp:609 sendArmCommand()]>> Failed to send arm command: 6(STATUS_TOO_DISTANT): \

the extensionSpeed = 0.1

maybe is the timing?

thanks !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions