Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Activate camera in station
#1
I am currently trying to figure out how to take the pre-existing camera items in my RDK workstation and activate them instead of doing a Cam2dAdd and making new cameras.
Is there a way to do this in the C# API?
I found it odd that there is a Cam2dClose function, but no Cam2dOpen.
#2
Hello,

This is possible using the setParam method in Python, which I think is SetParameter in C#.

Code:
camera = RDK.Item('Camera 1')
camera.setParam("Close") #"Open to start the camera
#3
(07-15-2021, 01:23 PM)Vineet Wrote:Hello,

This is possible using the setParam method in Python, which I think is SetParameter in C#.

Code:
camera = RDK.Item('Camera 1')
camera.setParam("Close") #"Open to start the camera

I tried the following in C#

camera.setParam("Open")

and I get the following error despite the camera activating in the RDK window.

"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond"

Note: I am using the RoboDK.cs from the SampleProject for this, if that matters.
#4
Hello,

Here is the code I tried and it works fine. Can you try this?

Code:
using System;

namespace SimpleNetcoreApplication
{
public class Program
{
static void Main(string[] args)
{
var rdk = new RoboDK();

// Connect to existing RoboDK or start a new one if RoboDK is not running
var status = rdk.Connect();
Console.WriteLine($"Connect status: {status}");

//RoboDK _RDK = new RoboDK();
RoboDK。它em camera = rdk.getItem("Camera 1");
camera.setParam("Open");

// close RoboDK
//rdk.CloseRoboDK();

}
}
}
Hope this helps you.
#5
(07-15-2021, 07:25 PM)Vineet Wrote:Hello,

Here is the code I tried and it works fine. Can you try this?

Code:
using System;

namespace SimpleNetcoreApplication
{
public class Program
{
static void Main(string[] args)
{
var rdk = new RoboDK();

// Connect to existing RoboDK or start a new one if RoboDK is not running
var status = rdk.Connect();
Console.WriteLine($"Connect status: {status}");

//RoboDK _RDK = new RoboDK();
RoboDK。它em camera = rdk.getItem("Camera 1");
camera.setParam("Open");

// close RoboDK
//rdk.CloseRoboDK();

}
}
}
Hope this helps you.

I inserted the code into the function and executed it.
"Connect status: True" is printed to the Console, and then the program crashes.

///
/// Send a specific parameter to RoboDK. This is reserved for internal purposes.
///

/// Item parameter
/// value
///
public string setParam(string param, string value = "")
{
link._require_build(7129);
link._check_connection();
link._send_Line("ICMD");
link._send_Item(this);
link._send_Line(param);
link._send_Line(value);
string response = link._recv_Line(); <<< Crash Happens Here
link._check_status();
return response;
}

它appears to crash while waiting for a response from the RDK window.
I'm curious if I am using an old version of the API code.




Users browsing this thread:
1 Guest(s)